From 35c540e7aa95f0c138dd0b393a67418311eee9e7 Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Wed, 29 May 2024 00:20:27 -0400 Subject: [PATCH] Update package metadata --- .github/workflows/release.yml | 5 +-- .github/workflows/test.yml | 2 +- AUTHORS.rst | 1 + CHANGES.rst | 2 + MANIFEST.in | 6 --- Makefile | 7 +--- pyproject.toml | 70 +++++++++++++++++++++++++++++++++++ setup.py | 56 ---------------------------- tox.ini | 5 ++- 9 files changed, 81 insertions(+), 73 deletions(-) delete mode 100644 MANIFEST.in delete mode 100644 setup.py diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ad3ac5be7..d946af7ba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,12 +24,11 @@ jobs: - name: Install dependencies run: | python -m pip install -U pip - python -m pip install -U setuptools twine wheel + python -m pip install -U build twine - name: Build package run: | - python setup.py --version - python setup.py sdist --format=gztar bdist_wheel + python -m build twine check dist/* - name: Upload packages to Jazzband diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 575ab7ac0..f3d23b49f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -73,7 +73,7 @@ jobs: python-version: ${{ matrix.python-version }} cache: 'pip' cache-dependency-path: | - setup.py + pyproject.toml tox.ini requirements/*.txt diff --git a/AUTHORS.rst b/AUTHORS.rst index 37f060e0b..3db6b7425 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -109,6 +109,7 @@ Authors - Nianpeng Li - Nick Träger - Noel James (`NoelJames `_) +- Ofek Lev (`ofek `_) - Phillip Marshall - Prakash Venkatraman (`dopatraman `_) - Rajesh Pappula diff --git a/CHANGES.rst b/CHANGES.rst index b4db1abfe..63c8db016 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,8 @@ Changes Unreleased ---------- +- Update package metadata to use modern standards + 3.6.0 (2024-05-26) ------------------ diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 99447902d..000000000 --- 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/Makefile b/Makefile index 04fc170e7..05b30ace6 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,7 @@ clean: clean-build clean-pyc rm -fr htmlcov/ clean-build: - rm -fr build/ rm -fr dist/ - rm -fr *.egg-info clean-pyc: find . -name '*.pyc' -exec rm -f {} + @@ -27,9 +25,8 @@ documentation: tox -e docs dist: clean - pip install -U wheel - python setup.py sdist - python setup.py bdist_wheel + pip install -U build + python -m build for file in dist/* ; do gpg --detach-sign -a "$$file" ; done ls -l dist diff --git a/pyproject.toml b/pyproject.toml index 52fb6e38c..04c6db20b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,73 @@ +[build-system] +requires = ["hatchling", "hatch-vcs", "hatch-fancy-pypi-readme"] +build-backend = "hatchling.build" + +[project] +name = "django-simple-history" +dynamic = ["version", "readme"] +description = "Store model history and view/revert changes from admin site." +license = "BSD-3-Clause" +requires-python = ">=3.8" +authors = [ + { name = "Corey Bertram", email = "corey@qr7.com" }, +] +maintainers = [ + { name = "Trey Hunner" }, +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Framework :: Django", + "Framework :: Django", + "Framework :: Django :: 3.2", + "Framework :: Django :: 4.2", + "Framework :: Django :: 5.0", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "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", +] +# DEV: Remove `asgiref` when the minimum required Django version is 4.2 +dependencies = ["asgiref>=3.6"] + +[project.urls] +Changelog = "https://github.com/jazzband/django-simple-history/blob/master/CHANGES.rst" +Documentation = "https://django-simple-history.readthedocs.io/" +Source = "https://github.com/jazzband/django-simple-history" +Tracker = "https://github.com/jazzband/django-simple-history/issues" + +[tool.hatch.version] +source = "vcs" + +[tool.hatch.version.raw-options] +version_scheme = "post-release" +local_scheme = "node-and-date" +fallback_version = "0.0.0" + +[tool.hatch.metadata.hooks.fancy-pypi-readme] +content-type = "text/x-rst" +fragments = [ + { path = "README.rst" }, + { path = "CHANGES.rst" }, +] + +[tool.hatch.build.targets.wheel] +packages = ["simple_history"] + +[tool.hatch.build.targets.sdist] +include = [ + "/docs", + "/simple_history", + "*.rst", + "*.txt", +] + [tool.black] line-length = 88 target-version = ["py38"] diff --git a/setup.py b/setup.py deleted file mode 100644 index 8e1909d60..000000000 --- a/setup.py +++ /dev/null @@ -1,56 +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"], - # DEV: Remove `asgiref` when the minimum required Django version is 4.2 - install_requires=["asgiref>=3.6"], - 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/", - "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 :: 3.2", - "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 dc692c674..d5f6c4ec5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,4 +1,5 @@ [tox] +isolated_build = true envlist = py{38,39,310}-dj32-{sqlite3,postgres,mysql,mariadb}, py{38,39,310,311,312}-dj42-{sqlite3,postgres,mysql,mariadb}, @@ -53,8 +54,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]