diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ad3ac5be..67759126 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,18 +24,18 @@ jobs: - name: Install dependencies run: | python -m pip install -U pip - python -m pip install -U setuptools twine wheel + python -m pip install -U hatch build twine - name: Build package run: | - python setup.py --version - python setup.py sdist --format=gztar bdist_wheel + hatch version + python -m build twine check dist/* - name: Upload packages to Jazzband if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1 with: user: jazzband password: ${{ secrets.JAZZBAND_RELEASE_KEY }} - repository_url: https://jazzband.co/projects/django-simple-history/upload + repository-url: https://jazzband.co/projects/django-simple-history/upload diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ad2a9b13..5b95a9e6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -65,7 +65,7 @@ jobs: python-version: ${{ matrix.python-version }} cache: 'pip' cache-dependency-path: | - setup.py + pyproject.toml tox.ini requirements/*.txt diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d93e4d7a..2e4e384a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,9 +35,19 @@ repos: - id: check-docstring-first - id: check-executables-have-shebangs - id: check-merge-conflict + - id: check-toml - id: debug-statements - id: detect-private-key + - repo: https://github.com/tox-dev/pyproject-fmt + rev: 2.1.3 + hooks: + - id: pyproject-fmt + - repo: https://github.com/abravalheri/validate-pyproject + rev: v0.18 + hooks: + - id: validate-pyproject + - repo: https://github.com/adrienverge/yamllint rev: v1.35.1 hooks: diff --git a/CHANGES.rst b/CHANGES.rst index 3766fad3..9d638095 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -7,6 +7,11 @@ Unreleased - Dropped support for Django 3.2, which reached end-of-life on 2024-04-01 (gh-1344) - Removed the temporary requirement on ``asgiref>=3.6`` added in 3.5.0, now that the minimum required Django version is 4.2 (gh-1344) +- Migrated package building from using the deprecated ``setup.py`` to using + ``pyproject.toml`` (with Hatchling as build backend); + ``setup.py`` has consequently been removed (gh-1348) + +.. Start of PyPI readme 3.6.0 (2024-05-26) ------------------ diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 99447902..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,6 +0,0 @@ -include MANIFEST.in -include *.rst -include *.txt -recursive-include docs *.rst -recursive-include simple_history/locale * -recursive-include simple_history/templates * diff --git a/README.rst b/README.rst index 9e872a1d..f054be6e 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,8 @@ django-simple-history |pypi-version| ==================================== +.. Start of PyPI readme + |jazzband| |build-status| |docs| |coverage| |maintainability| |code-style| |downloads| .. |pypi-version| image:: https://img.shields.io/pypi/v/django-simple-history.svg diff --git a/pyproject.toml b/pyproject.toml index 52fb6e38..36d123e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,83 @@ +[build-system] +build-backend = "hatchling.build" +requires = [ + "hatch-fancy-pypi-readme", + "hatch-vcs", + "hatchling", +] + +[project] +name = "django-simple-history" +description = "Store model history and view/revert changes from admin site." +maintainers = [ + { name = "Trey Hunner" }, +] +authors = [ + { name = "Corey Bertram", email = "corey@qr7.com" }, +] +requires-python = ">=3.8" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Framework :: Django", + "Framework :: Django :: 4.2", + "Framework :: Django :: 5.0", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + # DEV: uncomment this when the `pyproject-fmt` pre-commit hook stops removing it + #"Programming Language :: Python :: 3.13", +] +dynamic = [ + "readme", + "version", +] +dependencies = [ +] +urls.Changelog = "https://github.com/jazzband/django-simple-history/blob/master/CHANGES.rst" +urls.Documentation = "https://django-simple-history.readthedocs.io/en/stable/" +urls.Homepage = "https://github.com/jazzband/django-simple-history" +urls.Source = "https://github.com/jazzband/django-simple-history" +urls.Tracker = "https://github.com/jazzband/django-simple-history/issues" + +[tool.hatch.version] +source = "vcs" +fallback-version = "0.0.0" + +[tool.hatch.version.raw-options] +version_scheme = "no-guess-dev" +local_scheme = "node-and-date" + +[tool.hatch.build.targets.wheel] +# Jazzband's release process is limited to 2.2 metadata +core-metadata-version = "2.2" +packages = [ + "simple_history", +] + +[tool.hatch.build.targets.sdist] +# Jazzband's release process is limited to 2.2 metadata +core-metadata-version = "2.2" + +[tool.hatch.metadata.hooks.fancy-pypi-readme] +content-type = "text/x-rst" +fragments = [ + { path = "README.rst", start-after = ".. Start of PyPI readme\n\n" }, + { text = "\n====\n\nChangelog\n=========\n\n" }, + { path = "CHANGES.rst", start-after = ".. Start of PyPI readme\n\n" }, +] + [tool.black] line-length = 88 -target-version = ["py38"] +target-version = [ + "py38", +] [tool.isort] profile = "black" @@ -9,12 +86,19 @@ py_version = "38" [tool.coverage.run] parallel = true branch = true -source = ["simple_history"] +source = [ + "simple_history", +] [tool.coverage.paths] -source = ["simple_history", ".tox/*/site-packages"] +source = [ + "simple_history", + ".tox/*/site-packages", +] [tool.coverage.report] show_missing = true skip_covered = true -omit = ["requirements/*"] +omit = [ + "requirements/*", +] diff --git a/setup.py b/setup.py deleted file mode 100644 index f70b05fa..00000000 --- a/setup.py +++ /dev/null @@ -1,54 +0,0 @@ -from setuptools import setup - -with open("README.rst") as readme, open("CHANGES.rst") as changes: - setup( - name="django-simple-history", - use_scm_version={ - "version_scheme": "post-release", - "local_scheme": "node-and-date", - "relative_to": __file__, - "root": ".", - "fallback_version": "0.0.0", - }, - setup_requires=["setuptools_scm"], - install_requires=[], - description="Store model history and view/revert changes from admin site.", - long_description="\n".join((readme.read(), changes.read())), - long_description_content_type="text/x-rst", - author="Corey Bertram", - author_email="corey@qr7.com", - maintainer="Trey Hunner", - url="https://github.com/jazzband/django-simple-history", - project_urls={ - "Documentation": "https://django-simple-history.readthedocs.io/en/stable/", - "Changelog": "https://github.com/jazzband/django-simple-history/blob/master/CHANGES.rst", # noqa: E501 - "Source": "https://github.com/jazzband/django-simple-history", - "Tracker": "https://github.com/jazzband/django-simple-history/issues", - }, - packages=[ - "simple_history", - "simple_history.management", - "simple_history.management.commands", - "simple_history.templatetags", - ], - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Framework :: Django", - "Environment :: Web Environment", - "Intended Audience :: Developers", - "Framework :: Django", - "Framework :: Django :: 4.2", - "Framework :: Django :: 5.0", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "License :: OSI Approved :: BSD License", - ], - python_requires=">=3.8", - include_package_data=True, - ) diff --git a/tox.ini b/tox.ini index e5b11214..663be4c8 100644 --- a/tox.ini +++ b/tox.ini @@ -50,8 +50,8 @@ commands = [testenv:format] deps = -rrequirements/lint.txt commands = - isort docs simple_history runtests.py setup.py - black docs simple_history runtests.py setup.py + isort docs simple_history runtests.py + black docs simple_history runtests.py flake8 simple_history [testenv:lint]