Skip to content

Commit

Permalink
packaging: switch to hatch and pyproject.toml
Browse files Browse the repository at this point in the history
Start using hatch [1] for the project management. Run 'hatch new --init'
and do some manual changes on top:

- Use SPDX compatible license identifier for BSD-2-Clause

- Fix version path and pattern

- Include setup.py in packaging

- Exclude Makefiles from packaging

- Remove setup.cfg parts

Due to setuptools defaults [2], we've included some files from test/ as
well as the generated hawkmoth.egg-info in the source tarball. Drop
them.

[1] https://hatch.pypa.io/latest/
[2] https://setuptools.pypa.io/en/latest/userguide/miscellaneous.html
  • Loading branch information
jnikula committed Apr 23, 2024
1 parent 94ec0c9 commit 9725336
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 65 deletions.
72 changes: 68 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,73 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "hawkmoth"
dynamic = ["version"]
description = "Hawkmoth - Sphinx Autodoc for C"
readme = "README.rst"
license = "BSD-2-Clause"
requires-python = "~=3.8"
authors = [
{ name = "Jani Nikula", email = "[email protected]" },
]
build-backend = "setuptools.build_meta"
keywords = [
"autodoc",
"c",
"documentation",
"python",
"sphinx",
]
classifiers = [
"Development Status :: 4 - Beta",
"Framework :: Sphinx :: Extension",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Topic :: Documentation :: Sphinx",
"Topic :: Software Development :: Documentation",
]
dependencies = [
"sphinx >= 3",
]

[project.optional-dependencies]
dev = [
"flake8",
"pytest",
"pytest-cov",
"pytest-xdist",
"restructuredtext_lint",
"strictyaml",
]

[project.scripts]
hawkmoth = "hawkmoth.__main__:main"

[project.urls]
Documentation = "https://jnikula.github.io/hawkmoth/stable/"
Homepage = "https://github.com/jnikula/hawkmoth"

[tool.hatch.version]
path = "src/hawkmoth/VERSION"
pattern = "(?P<version>[a-zA-Z0-9._-]*)"

[tool.hatch.build.targets.sdist]
include = [
"/setup.py",
"/src",
]
exclude = [
"**/Makefile*",
]

[tool.hatch.build.targets.wheel]
exclude = [
"**/Makefile*",
]

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--strict-markers"
Expand Down
61 changes: 0 additions & 61 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,64 +1,3 @@
[metadata]
name = hawkmoth
version = file: src/hawkmoth/VERSION
author = Jani Nikula
author_email = [email protected]
description = Hawkmoth - Sphinx Autodoc for C
long_description = file: README.rst
long_description_content_type = text/x-rst
license = 2-Clause BSD
license_files = LICENSE
url = https://github.com/jnikula/hawkmoth
project_urls =
Documentation = https://jnikula.github.io/hawkmoth/stable/
keywords =
python
sphinx
autodoc
documentation
c
classifiers =
Development Status :: 4 - Beta
Framework :: Sphinx :: Extension
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Programming Language :: Python :: 3
Topic :: Documentation :: Sphinx
Topic :: Software Development :: Documentation

[options]
python_requires = ~=3.8
install_requires =
sphinx >= 3
# clang, depend on distro packaging
package_dir=
=src
packages =
hawkmoth
hawkmoth.ext
hawkmoth.ext.javadoc
hawkmoth.ext.napoleon
hawkmoth.ext.transformations
hawkmoth.util

[options.extras_require]
dev =
flake8
pytest
pytest-cov
pytest-xdist
restructuredtext_lint
strictyaml

[options.package_data]
hawkmoth =
VERSION

[options.entry_points]
console_scripts =
hawkmoth = hawkmoth.__main__:main

[flake8]
extend-ignore = E302,E305
max-line-length = 100

0 comments on commit 9725336

Please sign in to comment.