From ccc75d244d0f4452048f80fc73e39a34a4eefc00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Wed, 14 Sep 2022 07:33:27 -0700 Subject: [PATCH] Move to hatchling from setuptools MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernát Gábor --- .gitignore | 6 -- .pre-commit-config.yaml | 5 -- CHANGELOG.md | 4 ++ pyproject.toml | 66 ++++++++++++++++-- setup.cfg | 85 ------------------------ setup.py | 5 -- src/sphinx_autodoc_typehints/__init__.py | 2 +- tox.ini | 4 +- 8 files changed, 69 insertions(+), 108 deletions(-) delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.gitignore b/.gitignore index c7bedbd2..1e1b3ee5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,8 @@ -*.egg-info -build dist *.egg -.eggs *.py[codz] *$py.class .tox .*_cache -.idea -.vscode -/pip-wheel-metadata /src/sphinx_autodoc_typehints/version.py venv* diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 29a62500..53c5dbd6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,11 +43,6 @@ repos: hooks: - id: tox-ini-fmt args: ["-p", "fix"] - - repo: https://github.com/asottile/setup-cfg-fmt - rev: v2.0.0 - hooks: - - id: setup-cfg-fmt - args: [--min-py3-version, "3.7", "--max-py-version", "3.11"] - repo: https://github.com/PyCQA/flake8 rev: 5.0.4 hooks: diff --git a/CHANGELOG.md b/CHANGELOG.md index ef16a9a0..907e1e1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.20 + +- Use hatchling instead of setuptools + ## 1.19.2 - Fix incorrect domain used for collections.abc.Callable. diff --git a/pyproject.toml b/pyproject.toml index 2f7823b0..ab792c78 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,65 @@ [build-system] -requires = ["setuptools>=65.3", "setuptools_scm>=7.0.5"] -build-backend = 'setuptools.build_meta' +build-backend = "hatchling.build" +requires = ["hatchling>=1.9", "hatch-vcs>=0.2"] + +[project] +name = "sphinx_autodoc_typehints" +description = "Type hints (PEP 484) support for the Sphinx autodoc extension" +readme.file = "README.md" +readme.content-type = "text/markdown" +keywords = ["virtual", "environments", "isolated", "testing"] +license = "MIT" +urls.Homepage = "http://pyproject_api.readthedocs.org" +urls.Source = "https://github.com/tox-dev/sphinx-autodoc-typehints" +urls.Tracker = "https://github.com/tox-dev/sphinx-autodoc-typehints/issues" +urls.Changelog = "https://github.com/tox-dev/sphinx-autodoc-typehints/blob/main/CHANGELOG.md" +authors = [{ name = "Bernát Gábor", email = "gaborjbernat@gmail.com" }] +maintainers = [{ name = "Bernát Gábor", email = "gaborjbernat@gmail.com" }] +requires-python = ">=3.7" +dependencies = ["Sphinx>=5.1.1"] +optional-dependencies.docs = ["furo>=2022.6.21", "sphinx>=5.1.1", "sphinx-autodoc-typehints>=1.19.2"] +optional-dependencies.testing = [ + "covdefaults>=2.2", + "coverage>=6.4.4", + "diff-cover>=6.5.1", + "nptyping>=2.3.1", + "pytest>=7.1.3", + "pytest-cov>=3", + "sphobjinv>=2.2.2", + "typing-extensions>=4.3", +] +optional-dependencies.type_comment = ['typed-ast>=1.5.4; python_version < "3.8"'] +dynamic = ["version"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Framework :: Sphinx :: Extension", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Topic :: Documentation :: Sphinx", +] + +[tool.hatch] +build.hooks.vcs.version-file = "src/sphinx_autodoc_typehints/version.py" +version.source = "vcs" + +[tool.coverage] +html.show_contexts = true +html.skip_covered = false +paths.source = [ + "src", + ".tox*/*/lib/python*/site-packages", + ".tox*/pypy*/site-packages", + ".tox*\\*\\Lib\\site-packages", + "*/src", + "*\\src", +] +report.fail_under = 81 +report.omit = [] +run.parallel = true +run.plugins = ["covdefaults"] [tool.black] line-length = 120 @@ -10,9 +69,6 @@ line_length = 120 profile = "black" known_first_party = ["sphinx_autodoc_typehints", "tests"] -[tool.setuptools_scm] -write_to = "src/sphinx_autodoc_typehints/version.py" - [tool.pytest.ini_options] testpaths = ["tests"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 39ebaa3d..00000000 --- a/setup.cfg +++ /dev/null @@ -1,85 +0,0 @@ -[metadata] -name = sphinx_autodoc_typehints -description = Type hints (PEP 484) support for the Sphinx autodoc extension -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/tox-dev/sphinx-autodoc-typehints -author = Alex Grönholm -author_email = alex.gronholm@nextday.fi -license = MIT -license_file = LICENSE -classifiers = - Development Status :: 5 - Production/Stable - Framework :: Sphinx :: Extension - Intended Audience :: Developers - License :: OSI Approved :: MIT License - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Topic :: Documentation :: Sphinx -download_url = https://github.com/tox-dev/sphinx-autodoc-typehints/archive/main.zip -project_urls = - Changelog = https://github.com/tox-dev/sphinx-autodoc-typehints/blob/main/CHANGELOG.md - Source=https://github.com/tox-dev/sphinx-autodoc-typehints - Tracker=https://github.com/tox-dev/sphinx-autodoc-typehints/issues - -[options] -packages = find: -install_requires = - Sphinx>=5.1.1 -python_requires = >=3.7 -package_dir = - =src - -[options.packages.find] -where = src - -[options.extras_require] -testing = - covdefaults>=2.2 - coverage>=6.4.4 - diff-cover>=6.5.1 - nptyping>=2.3.1 - pytest>=7.1.3 - pytest-cov>=3 - sphobjinv>=2.2.2 - typing-extensions>=4.3 -type_comments = - typed-ast>=1.5.4;python_version < "3.8" - -[options.package_data] -sphinx_autodoc_typehints = py.typed - -[coverage:run] -plugins = covdefaults -parallel = true - -[coverage:paths] -src = - src - .tox/*/lib/python*/site-packages - .tox/pypy*/site-packages - .tox\*\Lib\site-packages\ - */src - *\src -other = - . - */sphinx-autodoc-typehints - *\sphinx-autodoc-typehints - -[coverage:report] -fail_under = 81 - -[coverage:html] -show_contexts = true -skip_covered = false - -[flake8] -max-complexity = 22 -max-line-length = 120 -ignore = E203, W503 -unused-arguments-ignore-abstract-functions = true -noqa-require-code = true - -[pep8] -max-line-length = 120 diff --git a/setup.py b/setup.py deleted file mode 100644 index a03590f5..00000000 --- a/setup.py +++ /dev/null @@ -1,5 +0,0 @@ -from __future__ import annotations - -from setuptools import setup - -setup() diff --git a/src/sphinx_autodoc_typehints/__init__.py b/src/sphinx_autodoc_typehints/__init__.py index 12ca8435..753921be 100644 --- a/src/sphinx_autodoc_typehints/__init__.py +++ b/src/sphinx_autodoc_typehints/__init__.py @@ -16,7 +16,7 @@ from sphinx.util.inspect import signature as sphinx_signature from sphinx.util.inspect import stringify_signature -from .version import version as __version__ +from .version import __version__ _LOGGER = logging.getLogger(__name__) _PYDATA_ANNOTATIONS = {"Any", "AnyStr", "Callable", "ClassVar", "Literal", "NoReturn", "Optional", "Tuple", "Union"} diff --git a/tox.ini b/tox.ini index fa42325c..dbc09722 100644 --- a/tox.ini +++ b/tox.ini @@ -26,7 +26,7 @@ extras = commands = pytest {tty:--color=yes} {posargs: \ --junitxml {toxworkdir}{/}junit.{envname}.xml --cov {envsitepackagesdir}{/}sphinx_autodoc_typehints --cov {toxinidir}{/}tests \ - --cov-config=setup.cfg --no-cov-on-fail --cov-report term-missing:skip-covered --cov-context=test \ + --cov-config=pyproject.toml --no-cov-on-fail --cov-report term-missing:skip-covered --cov-context=test \ --cov-report html:{envtmpdir}{/}htmlcov --cov-report xml:{toxworkdir}{/}coverage.{envname}.xml \ tests} diff-cover --compare-branch {env:DIFF_AGAINST:origin/main} {toxworkdir}{/}coverage.{envname}.xml @@ -99,6 +99,8 @@ commands = [flake8] max-complexity = 22 max-line-length = 120 +ignore = E203, W503 +unused-arguments-ignore-abstract-functions = true noqa-require-code = true [pep8]