From 894bc5a63e11f401ea6d1d5628d7314063a7dfee Mon Sep 17 00:00:00 2001 From: Sven Siegmund Date: Sun, 27 Nov 2022 03:00:07 +0100 Subject: [PATCH 1/5] Use hatchling build backend --- .coveragerc | 13 --- pyproject.toml | 230 +++++++++++++++++++++++++++++++++++++++++++++---- setup.cfg | 68 --------------- 3 files changed, 212 insertions(+), 99 deletions(-) delete mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 4903985c..00000000 --- a/.coveragerc +++ /dev/null @@ -1,13 +0,0 @@ -# https://pytest-cov.readthedocs.io/ - -[run] -source = semver -branch = True - -[report] -show_missing = true -precision = 1 -exclude_lines = - pragma: no cover - if __name__ == .__main__.: - if not hasattr\(__builtins__, .cmp.\): diff --git a/pyproject.toml b/pyproject.toml index 03e4873a..4df84244 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,34 +1,228 @@ -# -# -# See also https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html -# -# General idea taken from -# https://godatadriven.com/blog/a-practical-guide-to-setuptools-and-pyproject-toml/ - [build-system] requires = [ - # sync with setup.py until we discard non-pep-517/518 - "setuptools", - "setuptools-scm", - "wheel", - "build", + "hatchling>=1.8.0", +] +build-backend = "hatchling.build" + +[project] +name = "semver" +description = "Python helper for Semantic Versioning (https://semver.org)" +readme = "README.rst" +requires-python = ">=3.7" +authors = [ + { name = "Kostiantyn Rybnikov", email = "k-bx@k-bx.com" }, +] +maintainers = [ + { name = "Sebastien Celles", email = "s.celles@gmail.com" }, + { name = "Tom Schraitle" }, +] +keywords = [ + "python", + "version", + "semver", + "versioning", + "version", + "semantic-versioning", + "release", + "semver-format", + "semver-tag", + "semver-release", + "semver-cli", +] +classifiers = [ + "Environment :: Web Environment", + "Development Status :: 5 - Production/Stable", + "Topic :: Software Development", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Software Development :: Libraries :: Python Modules", +] +dependencies = [] +dynamic = [ + "version", +] + +[project.urls] +Homepage = "https://github.com/python-semver/python-semver" +Changelog = "https://python-semver.readthedocs.io/en/latest/changelog.html" +Documentation = "https://python-semver.rtfd.io" +Releases = "https://github.com/python-semver/python-semver/releases" +Issues = "https://github.com/python-semver/python-semver/issues" + +[project.license] +file = "LICENSE.txt" + +[project.scripts] +pysemver = "semver.cli:main" + +[tool.hatch.version] +path = "src/semver/__about__.py" + +[tool.hatch.build] +include = [ + "src/semver/*.py", + "src/semver/py.typed", +] + +[tool.hatch.envs.default] +dependencies = [ + "towncrier", + "wheel", +] + +[tool.hatch.envs.style] +dependencies = [ + "black", + "flake8", + "pycodestyle", +] + +[tool.hatch.envs.style.scripts] +fmt = [ + "black .", +] +lint = [ + "flake8 --exit-zero", + "pycodestyle", +] + +[tool.hatch.envs.docs] +dependencies = [ + "sphinx", + "sphinx-argparse", + "sphinx-autodoc-typehints", +] + +[tool.hatch.envs.docs.scripts] +build = "docs/make.bat -C docs html" +linkcheck = "docs/make.bat -C docs linkcheck" +serve = "python3 -m webbrowser -t docs/_build/html/index.html" + +[tool.hatch.envs.test] +dependencies = [ + "pytest-cov", +] + +[[tool.hatch.envs.test.matrix]] +python = ["37", ] + +[tool.hatch.envs.test.scripts] +cov = "pytest -vx" +no-cov = "cov --no-cov" +tox_test = "tox" + +[tool.hatch.envs.testall] +dependencies = [ + "pytest-cov", +] +[[tool.hatch.envs.testall.matrix]] +python = ["37", "38", "39", "310", "311", ] + +[tool.hatch.envs.testall.scripts] +cov = "pytest -vx" +no-cov = "cov --no-cov" + +[tool.hatch.envs.tox] +dependencies = [ + "tox", +] + +[tool.hatch.envs.tox.scripts] +test = "tox" + +[tool.coverage.run] +source = "semver" +branch = true +parallel = true +omit = [ + # add files to exclude them from the coverage report, e.g. + "src/semver/_types.py", +] + +[tool.coverage.report] +show_missing = true +precicion = 1 +exclude_lines = [ + "no cover", + "if __name__ == .__main__.:", + "if TYPE_CHECKING:", + # note the use of single quote below to denote "raw" strings in TOML + 'if not hasattr\(__builtins__, .cmp.\):', + 'class .*\bProtocol\):', + '@(abc\.)?abstractmethod', +] + +[tool.mypy] +# the mypy settings go here +# To have the `py.typed` file installed with the package we had to include it +# in the build metadata (see [tool.hatch.build]) +enable_error_code = [ + "ignore-without-code", +] +show_error_codes = true +warn_unused_ignores = true +implicit_reexport = true +pretty = true +follow_imports = "normal" + +[tool.pytest.ini_options] +norecursedirs = [ + ".git", + "build", + ".env/", + "env/", + ".pyenv/", + ".tmp/", + ".eggs/", + "venv/", +] +testpaths = [ + "tests", + "docs", +] +filterwarnings = [ + "ignore::DeprecationWarning", + 'ignore:Function semver.*:DeprecationWarning', +] +addopts = [ + "--no-cov-on-fail", + "--cov=semver", + "--cov-report=term-missing", + "--doctest-glob='*.rst'", + "--doctest-modules", + "--doctest-report ndiff", ] -build-backend = "setuptools.build_meta" +# flake8 does not support configuration in pyproject.toml +# see https://github.com/PyCQA/flake8/issues/234 +# (there are alternatives, e.g. https://github.com/john-hen/Flake8-pyproject) +# we stick to the original flake8 with configuration +# in the `[flake8]` section of setup.cfg +# pycodestyle does not support configuration in pyproject.toml +# We stick to the original pycodestyle configuration +# in the `[pycodestyle]` section of setup.cfg [tool.black] line-length = 88 -target-version = ['py36', 'py37', 'py38', 'py39', 'py310'] +target-version = ["py36", "py37", "py38", "py39", "py310"] # diff = true -extend-exclude = ''' +extend-exclude = """ # A regex preceded with ^/ will apply only to files and directories # in the root of the project. ^/*.py -''' -include = ''' +""" +include = """ ^/setup.py -''' +""" [tool.towncrier] package = "semver" diff --git a/setup.cfg b/setup.cfg index 4087e787..25e61ce6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,71 +1,3 @@ -# -# Metadata for setup.py -# -# See https://setuptools.rtfd.io/en/latest/userguide/declarative_config.html - -[metadata] -name = semver -version = attr: semver.__about__.__version__ -description = Python helper for Semantic Versioning (https://semver.org) -long_description = file: README.rst -long_description_content_type = text/x-rst -author = Kostiantyn Rybnikov -author_email = k-bx@k-bx.com -maintainer = Sebastien Celles, Tom Schraitle -maintainer_email = s.celles@gmail.com -url = https://github.com/python-semver/python-semver -project_urls = - Changelog = https://python-semver.readthedocs.io/en/latest/changelog.html - Documentation = https://python-semver.rtfd.io - Releases = https://github.com/python-semver/python-semver/releases - Bug Tracker = https://github.com/python-semver/python-semver/issues -classifiers = - Environment :: Web Environment - Intended Audience :: Developers - License :: OSI Approved :: BSD License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Topic :: Software Development :: Libraries :: Python Modules -license = BSD - -[options] -package_dir = - =src -packages = find: -python_requires = >=3.6.* -include_package_data = True - -[options.entry_points] -console_scripts = - pysemver = semver.cli:main - -[options.packages.find] -where = src - -[options.package_data] -semver = py.typed - -[tool:pytest] -norecursedirs = .git build .env/ env/ .pyenv/ .tmp/ .eggs/ venv/ -testpaths = tests docs -filterwarnings = - ignore:Function 'semver.*:DeprecationWarning - # ' <- This apostroph is just to fix syntax highlighting -addopts = - --no-cov-on-fail - --cov=semver - --cov-report=term-missing - --doctest-glob='*.rst' - --doctest-modules - --doctest-report ndiff - [flake8] max-line-length = 88 ignore = F821,W503 From 0deb9db219bb1340d04d2b3651a33ed8477ce4e1 Mon Sep 17 00:00:00 2001 From: Sven Siegmund Date: Sun, 27 Nov 2022 03:05:06 +0100 Subject: [PATCH 2/5] Use literal strings in black config --- pyproject.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4df84244..433f592f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -215,14 +215,14 @@ addopts = [ line-length = 88 target-version = ["py36", "py37", "py38", "py39", "py310"] # diff = true -extend-exclude = """ +extend-exclude = ''' # A regex preceded with ^/ will apply only to files and directories # in the root of the project. ^/*.py -""" -include = """ +''' +include = ''' ^/setup.py -""" +''' [tool.towncrier] package = "semver" From 8c79f4c0bb52534dfe89dc3c9608729e6e8c59e3 Mon Sep 17 00:00:00 2001 From: Sven Siegmund Date: Sun, 27 Nov 2022 03:06:22 +0100 Subject: [PATCH 3/5] remove tox_test script from test env --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 433f592f..66fa3a8c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -117,7 +117,6 @@ python = ["37", ] [tool.hatch.envs.test.scripts] cov = "pytest -vx" no-cov = "cov --no-cov" -tox_test = "tox" [tool.hatch.envs.testall] dependencies = [ From d9a9b695d8ae3dc1803eb24de37ccdc1bb4a0364 Mon Sep 17 00:00:00 2001 From: Sven Siegmund Date: Sun, 27 Nov 2022 04:46:56 +0100 Subject: [PATCH 4/5] Use hatchling build backend --- changelog.d/373.trivial.rst | 1 + pyproject.toml | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 changelog.d/373.trivial.rst diff --git a/changelog.d/373.trivial.rst b/changelog.d/373.trivial.rst new file mode 100644 index 00000000..5705a297 --- /dev/null +++ b/changelog.d/373.trivial.rst @@ -0,0 +1 @@ +Use hatchling build backend diff --git a/pyproject.toml b/pyproject.toml index 66fa3a8c..6b111a41 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,12 +66,14 @@ pysemver = "semver.cli:main" [tool.hatch.version] path = "src/semver/__about__.py" -[tool.hatch.build] -include = [ - "src/semver/*.py", - "src/semver/py.typed", +[tool.hatch.build.targets.wheel] +packages = [ + "src/semver", ] +[tool.hatch.build.targets.wheel.force-include] +"src/semver/py.typed" = "semver/py.typed" + [tool.hatch.envs.default] dependencies = [ "towncrier", @@ -96,7 +98,7 @@ lint = [ [tool.hatch.envs.docs] dependencies = [ - "sphinx", + #"sphinx", "sphinx-argparse", "sphinx-autodoc-typehints", ] @@ -108,6 +110,7 @@ serve = "python3 -m webbrowser -t docs/_build/html/index.html" [tool.hatch.envs.test] dependencies = [ + "coverage[toml]", "pytest-cov", ] @@ -120,6 +123,7 @@ no-cov = "cov --no-cov" [tool.hatch.envs.testall] dependencies = [ + "coverage[toml]", "pytest-cov", ] [[tool.hatch.envs.testall.matrix]] @@ -138,7 +142,9 @@ dependencies = [ test = "tox" [tool.coverage.run] -source = "semver" +source = [ + "semver", +] branch = true parallel = true omit = [ @@ -148,7 +154,7 @@ omit = [ [tool.coverage.report] show_missing = true -precicion = 1 +precision = 1 exclude_lines = [ "no cover", "if __name__ == .__main__.:", @@ -162,7 +168,7 @@ exclude_lines = [ [tool.mypy] # the mypy settings go here # To have the `py.typed` file installed with the package we had to include it -# in the build metadata (see [tool.hatch.build]) +# in the build metadata (see [tool.hatch.build.targets.wheel.force-include]) enable_error_code = [ "ignore-without-code", ] From 01f0f6683539a1a8bb38bf6d0558e328452c217c Mon Sep 17 00:00:00 2001 From: Sven Siegmund Date: Sun, 27 Nov 2022 05:00:40 +0100 Subject: [PATCH 5/5] Update coverage source path --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 6b111a41..27b5a065 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -144,6 +144,7 @@ test = "tox" [tool.coverage.run] source = [ "semver", + #"src/semver/*", ] branch = true parallel = true @@ -220,6 +221,7 @@ addopts = [ line-length = 88 target-version = ["py36", "py37", "py38", "py39", "py310"] # diff = true +# note the use of single quotes below to denote "raw" strings in TOML extend-exclude = ''' # A regex preceded with ^/ will apply only to files and directories # in the root of the project. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy