Skip to content

Hatchbuild #376

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

Closed
wants to merge 4 commits into from
Closed
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ __pycache__/
# C extensions
*.so

# API documentation generated by pdoc3
api-docs/

# Distribution / packaging
.Python
build/
Expand Down
1 change: 1 addition & 0 deletions changelog.d/373.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Changed build backend to hatchling
1 change: 1 addition & 0 deletions changelog.d/374.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated format of Towncrier's configuration in ``pyproject.toml``
2 changes: 1 addition & 1 deletion docs/advanced/coerce.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re
from semver import Version
from typing import Optional, Tuple

from semver import Version

BASEVERSION = re.compile(
r"""[vV]?
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import codecs
from datetime import date
import os
import re
import sys
from datetime import date

SRC_DIR = os.path.abspath("../src/")
sys.path.insert(0, SRC_DIR)
Expand Down
251 changes: 194 additions & 57 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,34 +1,184 @@
#
#
# 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 = [
# I think python-semver is more "Console" than "Web Environment"
#"Environment :: Web Environment",
"Environment :: Console",
"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",
]
build-backend = "setuptools.build_meta"
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",
"isort",
"flake8",
"pycodestyle",
]

[tool.hatch.envs.style.scripts]
fmt = [
"black .",
"isort .",
]
lint = [
"flake8 --exit-zero",
"pycodestyle",
]

[tool.hatch.envs.docs]
dependencies = [
"pdoc3"
]

[tool.hatch.envs.docs.scripts]
build = "pdoc --html --output-dir api-docs src/semver --force"
serve = "pdoc --http : python-semver"

[tool.hatch.envs.test]
dependencies = [
"pytest-cov",
"tox",
]

[tool.hatch.envs.test.scripts]
cov = "pytest -vx"
no-cov = "cov --no-cov"
tox_test = "tox"

[[tool.hatch.envs.test.matrix]]
python = ["310", "311"]

[tool.coverage.run]
branch = true
parallel = true
omit = [
# add files to exclude them from the coverage report, e.g.
# "src/semver/__about__.py"
]

[tool.coverage.report]
exclude_lines = [
"no cov",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
]

[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])

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

# 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 = ['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"
Expand All @@ -40,42 +190,29 @@ template = "changelog.d/_template.rst"
# issue_format = "`#{issue} <https://github.com/python-attrs/attrs/issues/{issue}>`_"
# issue_format = ":gh:`{issue}`"

# [[tool.towncrier.type]]
# directory = "breaking"
# name = "Breaking Changes"
# showcontent = true

[[tool.towncrier.type]]
directory = "deprecation"
name = "Deprecations"
showcontent = true

[[tool.towncrier.type]]
directory = "feature"
name = "Features"
showcontent = true

# [[tool.towncrier.type]]
# directory = "improvement"
# name = "Improvements"
# showcontent = true

[[tool.towncrier.type]]
directory = "bugfix"
name = "Bug Fixes"
showcontent = true

[[tool.towncrier.type]]
directory = "doc"
name = "Improved Documentation"
showcontent = true

[[tool.towncrier.type]]
directory = "trivial"
name = "Trivial/Internal Changes"
showcontent = true

[[tool.towncrier.type]]
directory = "removal"
name = "Removals"
showcontent = true
# [tool.towncrier.fragment.breaking]
# name = "Breaking Changes"
# showcontent = true

[tool.towncrier.fragment.deprecation]
name = "Deprecations"

[tool.towncrier.fragment.feature]
directory = "feature"
name = "Features"

# [tool.towncrier.fragment.improvement]
# name = "Improvements"
# showcontent = true

[tool.towncrier.fragment.bugfix]
name = "Bug Fixes"

[tool.towncrier.fragment.doc]
name = "Improved Documentation"

[tool.towncrier.fragment.trivial]
name = "Trivial/Internal Changes"

[tool.towncrier.fragment.removal]
name = "Removals"
68 changes: 0 additions & 68 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading