Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start using hatch for Python project management #241

Merged
merged 5 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
*~
.coverage
.venv
build
dist
hawkmoth.egg-info
test/coverage-report
15 changes: 5 additions & 10 deletions Makefile.local
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,18 @@ check-style:
check-rst:
rst-lint --level warning $(RST)

# assume virtual environment is used for dist and upload
.PHONY: build-tools
build-tools:
pip install --upgrade build twine

# Build and publish
.PHONY: build
build:
rm -rf build dist hawkmoth.egg-info
python3 -m build
hatch build

.PHONY: test-upload
test-upload:
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
hatch publish --repo test

.PHONY: upload
upload:
twine upload dist/*
hatch publish

.PHONY: clean
clean:
Expand All @@ -44,4 +39,4 @@ distclean: clean

.SUFFIXES:

DISTCLEAN := $(DISTCLEAN) build dist hawkmoth.egg-info
DISTCLEAN := $(DISTCLEAN) dist
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 = {file = "README.rst", content-type = "text/x-rst"}
license = {text = "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]
Homepage = "https://github.com/jnikula/hawkmoth"
Documentation = "https://jnikula.github.io/hawkmoth/stable/"

[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
Loading