From 560f2983a03b0433fbf5ddc652e47d59f23eae5d Mon Sep 17 00:00:00 2001 From: Anders <6058745+ddabble@users.noreply.github.com> Date: Wed, 29 May 2024 16:00:19 +0200 Subject: [PATCH 1/4] Dropped support for Django 3.2 (#1344) Its EOL was passed last month (April 1st); see https://www.djangoproject.com/download/#supported-versions. The changes in `test_admin.py` were made to slightly reduce the amount of work required when dropping support for Django 4.2 in the future (also the previous comments contained a typo, and should have said "prior to Django 5.0" instead of "prior to Django 4.2"). --- .github/workflows/test.yml | 10 +----- CHANGES.rst | 3 ++ README.rst | 1 - docs/index.rst | 1 - requirements/postgres.txt | 5 +-- requirements/test.txt | 2 -- runtests.py | 16 ++++------ setup.py | 4 +-- simple_history/tests/tests/test_admin.py | 36 +++++++++++++--------- simple_history/tests/tests/test_manager.py | 15 --------- tox.ini | 5 +-- 11 files changed, 34 insertions(+), 64 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 575ab7ac0..ad2a9b134 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: fail-fast: false matrix: python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13-dev'] - django-version: ['3.2', '4.2', '5.0', 'main'] + django-version: ['4.2', '5.0', 'main'] exclude: # Exclude py3.8 and py3.9 for Django main and 5.0 @@ -25,14 +25,6 @@ jobs: - python-version: '3.9' django-version: 'main' - # Exclude py3.11, py3.12 and py3.13 for Django 3.2 - - python-version: '3.11' - django-version: '3.2' - - python-version: '3.12' - django-version: '3.2' - - python-version: '3.13-dev' - django-version: '3.2' - services: postgres: diff --git a/CHANGES.rst b/CHANGES.rst index b4db1abfe..3766fad38 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,9 @@ Changes 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) 3.6.0 (2024-05-26) ------------------ diff --git a/README.rst b/README.rst index c8442f686..79b1ec075 100644 --- a/README.rst +++ b/README.rst @@ -41,7 +41,6 @@ This app supports the following combinations of Django and Python: ========== ======================== Django Python ========== ======================== -3.2 3.8, 3.9, 3.10 4.2 3.8, 3.9, 3.10, 3.11, 3.12, 3.13-dev 5.0 3.10, 3.11, 3.12, 3.13-dev main 3.10, 3.11, 3.12, 3.13-dev diff --git a/docs/index.rst b/docs/index.rst index e6eaaf749..2276ba9f6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -41,7 +41,6 @@ This app supports the following combinations of Django and Python: ========== ======================= Django Python ========== ======================= -3.2 3.8, 3.9, 3.10 4.2 3.8, 3.9, 3.10, 3.11, 3.12, 3.13-dev 5.0 3.10, 3.11, 3.12, 3.13-dev main 3.10, 3.11, 3.12, 3.13-dev diff --git a/requirements/postgres.txt b/requirements/postgres.txt index aaa87fe1b..d240df452 100644 --- a/requirements/postgres.txt +++ b/requirements/postgres.txt @@ -1,4 +1 @@ -# DEV: Replace this with `psycopg[binary]` when the minimum required Django version is -# 4.2 or higher, as this is likely to be deprecated in the future -# (see https://docs.djangoproject.com/en/4.2/releases/4.2/#psycopg-3-support) -psycopg2-binary==2.9.9 +psycopg[binary]==3.1.19 diff --git a/requirements/test.txt b/requirements/test.txt index 0b7414dc3..ae6ed25c0 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,3 +1 @@ -r ./coverage.txt -# DEV: Remove this requirement entirely when the minimum required Django version is 4.2 -asgiref>=3.6 diff --git a/runtests.py b/runtests.py index 62ebbef79..de2e9c194 100755 --- a/runtests.py +++ b/runtests.py @@ -135,6 +135,12 @@ def __getitem__(self, item): }, } ], + STORAGES={ + "default": { + # Speeds up tests and prevents locally storing files created through them + "BACKEND": "django.core.files.storage.InMemoryStorage", + }, + }, DEFAULT_AUTO_FIELD="django.db.models.AutoField", USE_TZ=False, ) @@ -146,16 +152,6 @@ def __getitem__(self, item): DEFAULT_SETTINGS["MIDDLEWARE"] = MIDDLEWARE -# DEV: Merge these settings into DEFAULT_SETTINGS when the minimum required -# Django version is 4.2 or higher -if django.VERSION >= (4, 2): - DEFAULT_SETTINGS["STORAGES"] = { - "default": { - # Speeds up tests and prevents locally storing files created through them - "BACKEND": "django.core.files.storage.InMemoryStorage", - }, - } - def get_default_settings(*, database_name=DEFAULT_DATABASE_NAME): return { diff --git a/setup.py b/setup.py index 8e1909d60..cf90376a4 100644 --- a/setup.py +++ b/setup.py @@ -11,8 +11,7 @@ "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"], + 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", @@ -38,7 +37,6 @@ "Environment :: Web Environment", "Intended Audience :: Developers", "Framework :: Django", - "Framework :: Django :: 3.2", "Framework :: Django :: 4.2", "Framework :: Django :: 5.0", "Programming Language :: Python", diff --git a/simple_history/tests/tests/test_admin.py b/simple_history/tests/tests/test_admin.py index 02b5bdc52..d85e51a54 100644 --- a/simple_history/tests/tests/test_admin.py +++ b/simple_history/tests/tests/test_admin.py @@ -1,6 +1,7 @@ from datetime import datetime, timedelta from unittest.mock import ANY, patch +import django from django.contrib.admin import AdminSite from django.contrib.admin.utils import quote from django.contrib.auth import get_user_model @@ -621,6 +622,7 @@ def test_history_form_view_without_getting_history(self): context = { **admin_site.each_context(request), # Verify this is set for original object + "log_entries": ANY, "original": poll, "change_history": False, "title": "Revert %s" % force_str(poll), @@ -650,9 +652,9 @@ def test_history_form_view_without_getting_history(self): "save_on_top": admin.save_on_top, "root_path": getattr(admin_site, "root_path", None), } - # This key didn't exist prior to Django 4.2 - if "log_entries" in context: - context["log_entries"] = ANY + # DEV: Remove this when support for Django 4.2 has been dropped + if django.VERSION < (5, 0): + del context["log_entries"] mock_render.assert_called_once_with( request, admin.object_history_form_template, context @@ -680,6 +682,7 @@ def test_history_form_view_getting_history(self): context = { **admin_site.each_context(request), # Verify this is set for history object not poll object + "log_entries": ANY, "original": history.instance, "change_history": True, "title": "Revert %s" % force_str(history.instance), @@ -709,9 +712,9 @@ def test_history_form_view_getting_history(self): "save_on_top": admin.save_on_top, "root_path": getattr(admin_site, "root_path", None), } - # This key didn't exist prior to Django 4.2 - if "log_entries" in context: - context["log_entries"] = ANY + # DEV: Remove this when support for Django 4.2 has been dropped + if django.VERSION < (5, 0): + del context["log_entries"] mock_render.assert_called_once_with( request, admin.object_history_form_template, context @@ -739,6 +742,7 @@ def test_history_form_view_getting_history_with_setting_off(self): context = { **admin_site.each_context(request), # Verify this is set for history object not poll object + "log_entries": ANY, "original": poll, "change_history": False, "title": "Revert %s" % force_str(poll), @@ -768,9 +772,9 @@ def test_history_form_view_getting_history_with_setting_off(self): "save_on_top": admin.save_on_top, "root_path": getattr(admin_site, "root_path", None), } - # This key didn't exist prior to Django 4.2 - if "log_entries" in context: - context["log_entries"] = ANY + # DEV: Remove this when support for Django 4.2 has been dropped + if django.VERSION < (5, 0): + del context["log_entries"] mock_render.assert_called_once_with( request, admin.object_history_form_template, context @@ -798,6 +802,7 @@ def test_history_form_view_getting_history_abstract_external(self): context = { **admin_site.each_context(request), # Verify this is set for history object + "log_entries": ANY, "original": history.instance, "change_history": True, "title": "Revert %s" % force_str(history.instance), @@ -829,9 +834,9 @@ def test_history_form_view_getting_history_abstract_external(self): "save_on_top": admin.save_on_top, "root_path": getattr(admin_site, "root_path", None), } - # This key didn't exist prior to Django 4.2 - if "log_entries" in context: - context["log_entries"] = ANY + # DEV: Remove this when support for Django 4.2 has been dropped + if django.VERSION < (5, 0): + del context["log_entries"] mock_render.assert_called_once_with( request, admin.object_history_form_template, context @@ -862,6 +867,7 @@ def test_history_form_view_accepts_additional_context(self): context = { **admin_site.each_context(request), # Verify this is set for original object + "log_entries": ANY, "anything_else": "will be merged into context", "original": poll, "change_history": False, @@ -892,9 +898,9 @@ def test_history_form_view_accepts_additional_context(self): "save_on_top": admin.save_on_top, "root_path": getattr(admin_site, "root_path", None), } - # This key didn't exist prior to Django 4.2 - if "log_entries" in context: - context["log_entries"] = ANY + # DEV: Remove this when support for Django 4.2 has been dropped + if django.VERSION < (5, 0): + del context["log_entries"] mock_render.assert_called_once_with( request, admin.object_history_form_template, context diff --git a/simple_history/tests/tests/test_manager.py b/simple_history/tests/tests/test_manager.py index a10eda51c..75bf94a78 100644 --- a/simple_history/tests/tests/test_manager.py +++ b/simple_history/tests/tests/test_manager.py @@ -1,7 +1,6 @@ from datetime import datetime, timedelta from operator import attrgetter -import django from django.contrib.auth import get_user_model from django.db import IntegrityError from django.test import TestCase, override_settings, skipUnlessDBFeature @@ -199,13 +198,6 @@ def setUp(self): Poll(id=4, question="Question 4", pub_date=datetime.now()), ] - # DEV: Remove this method when the minimum required Django version is 4.2 - def assertQuerySetEqual(self, *args, **kwargs): - if django.VERSION < (4, 2): - return self.assertQuerysetEqual(*args, **kwargs) - else: - return super().assertQuerySetEqual(*args, **kwargs) - def test_simple_bulk_history_create(self): created = Poll.history.bulk_history_create(self.data) self.assertEqual(len(created), 4) @@ -334,13 +326,6 @@ def setUp(self): Poll(id=4, question="Question 4", pub_date=datetime.now()), ] - # DEV: Remove this method when the minimum required Django version is 4.2 - def assertQuerySetEqual(self, *args, **kwargs): - if django.VERSION < (4, 2): - return self.assertQuerysetEqual(*args, **kwargs) - else: - return super().assertQuerySetEqual(*args, **kwargs) - def test_simple_bulk_history_create(self): created = Poll.history.bulk_history_create(self.data, update=True) self.assertEqual(len(created), 4) diff --git a/tox.ini b/tox.ini index dc692c674..e5b11214a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,10 @@ [tox] envlist = - py{38,39,310}-dj32-{sqlite3,postgres,mysql,mariadb}, py{38,39,310,311,312}-dj42-{sqlite3,postgres,mysql,mariadb}, py{310,311,312}-dj50-{sqlite3,postgres,mysql,mariadb}, py{310,311,312}-djmain-{sqlite3,postgres,mysql,mariadb}, # DEV: Add `313` to the Python versions above (so that postgres is tested with 3.13) - # when `psycopg2-binary` supports 3.13 + # when `psycopg` provides binaries for 3.13 py313-dj{42,50,main}-{sqlite3,mysql,mariadb}, docs, lint @@ -21,7 +20,6 @@ python = [gh-actions:env] DJANGO = - 3.2: dj32 4.2: dj42 5.0: dj50 main: djmain @@ -35,7 +33,6 @@ exclude = __init__.py,simple_history/registry_tests/migration_test_app/migration [testenv] deps = -rrequirements/test.txt - dj32: Django>=3.2,<3.3 dj42: Django>=4.2,<4.3 dj50: Django>=5.0,<5.1 djmain: https://github.com/django/django/tarball/main From 87a08b7a1d5e3dcb4356478f23ebfb6825512fdb Mon Sep 17 00:00:00 2001 From: Anders <6058745+ddabble@users.noreply.github.com> Date: Tue, 28 May 2024 19:30:09 +0200 Subject: [PATCH 2/4] Changed docs link to stable version This can help avoid potential confusion, like what appears to have been the cause of #1326. --- README.rst | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 79b1ec075..39c391606 100644 --- a/README.rst +++ b/README.rst @@ -49,7 +49,7 @@ main 3.10, 3.11, 3.12, 3.13-dev Getting Help ------------ -Documentation is available at https://django-simple-history.readthedocs.io/ +Documentation is available at https://django-simple-history.readthedocs.io/en/stable/ Pull requests are welcome. Read the `CONTRIBUTING`_ file for tips on submitting a pull request. diff --git a/setup.py b/setup.py index cf90376a4..f70b05faa 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ maintainer="Trey Hunner", url="https://github.com/jazzband/django-simple-history", project_urls={ - "Documentation": "https://django-simple-history.readthedocs.io/", + "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", From cf6848c0c753a7adbd90eb331017d0a98217ea32 Mon Sep 17 00:00:00 2001 From: Anders <6058745+ddabble@users.noreply.github.com> Date: Tue, 28 May 2024 19:37:38 +0200 Subject: [PATCH 3/4] Tweaked layout of README badges They're now aligned left-to-right instead of above each other on GitHub. (The rendered RST on PyPI and in the docs should be unaffected.) Also changed their order. --- README.rst | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/README.rst b/README.rst index 39c391606..9e872a1db 100644 --- a/README.rst +++ b/README.rst @@ -1,40 +1,42 @@ -django-simple-history -===================== +django-simple-history |pypi-version| +==================================== -.. image:: https://github.com/jazzband/django-simple-history/actions/workflows/test.yml/badge.svg +|jazzband| |build-status| |docs| |coverage| |maintainability| |code-style| |downloads| + +.. |pypi-version| image:: https://img.shields.io/pypi/v/django-simple-history.svg + :target: https://pypi.org/project/django-simple-history/ + :alt: PyPI Version + +.. |jazzband| image:: https://jazzband.co/static/img/badge.svg + :target: https://jazzband.co/ + :alt: Jazzband + +.. |build-status| image:: https://github.com/jazzband/django-simple-history/actions/workflows/test.yml/badge.svg :target: https://github.com/jazzband/django-simple-history/actions/workflows/test.yml :alt: Build Status -.. image:: https://readthedocs.org/projects/django-simple-history/badge/?version=latest +.. |docs| image:: https://readthedocs.org/projects/django-simple-history/badge/?version=latest :target: https://django-simple-history.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status -.. image:: https://img.shields.io/codecov/c/github/jazzband/django-simple-history/master.svg +.. |coverage| image:: https://img.shields.io/codecov/c/github/jazzband/django-simple-history/master.svg :target: https://app.codecov.io/github/jazzband/django-simple-history?branch=master :alt: Test Coverage -.. image:: https://img.shields.io/pypi/v/django-simple-history.svg - :target: https://pypi.org/project/django-simple-history/ - :alt: PyPI Version - -.. image:: https://api.codeclimate.com/v1/badges/66cfd94e2db991f2d28a/maintainability +.. |maintainability| image:: https://api.codeclimate.com/v1/badges/66cfd94e2db991f2d28a/maintainability :target: https://codeclimate.com/github/jazzband/django-simple-history/maintainability :alt: Maintainability -.. image:: https://static.pepy.tech/badge/django-simple-history - :target: https://pepy.tech/project/django-simple-history - :alt: Downloads - -.. image:: https://img.shields.io/badge/code%20style-black-000000.svg +.. |code-style| image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/black :alt: Code Style -.. image:: https://jazzband.co/static/img/badge.svg - :target: https://jazzband.co/ - :alt: Jazzband +.. |downloads| image:: https://static.pepy.tech/badge/django-simple-history + :target: https://pepy.tech/project/django-simple-history + :alt: Downloads -django-simple-history stores Django model state on every create/update/delete. +``django-simple-history`` stores Django model state on every create/update/delete. This app supports the following combinations of Django and Python: @@ -51,7 +53,7 @@ Getting Help Documentation is available at https://django-simple-history.readthedocs.io/en/stable/ -Pull requests are welcome. Read the `CONTRIBUTING`_ file for tips on +Pull requests are welcome. Read the `CONTRIBUTING`_ file for tips on submitting a pull request. .. _CONTRIBUTING: https://github.com/jazzband/django-simple-history/blob/master/CONTRIBUTING.rst From fef00f6e9130d0b817e95eb3ede893a0540032df Mon Sep 17 00:00:00 2001 From: Anders <6058745+ddabble@users.noreply.github.com> Date: Tue, 28 May 2024 22:47:30 +0200 Subject: [PATCH 4/4] Migrated setup.py -> pyproject.toml with Hatchling Most of the changes to `pyproject.toml` were made by running `hatch new --init` (see https://hatch.pypa.io/latest/intro/#existing-project). Most of the changes to the other files were based on the changes made in https://github.com/jazzband/django-debug-toolbar/pull/1690. ### `release.yml`: * `hatch version` is run instead of `hatchling version` (as is done in the PR mentioned above), as the latter crashes with the error: ``` hatchling.plugin.exceptions.UnknownPluginError: Unknown version source: vcs ``` Installing `hatch` takes considerably longer than just `hatchling`, but I think it's still acceptable. * Updated the `pypa/gh-action-pypi-publish` action from the sunset `master` branch to `release/v1`; see warning at https://github.com/jazzband/django-simple-history/actions/runs/9246937361. Also replaced the deprecated `repository_url` with `repository-url`; see https://github.com/pypa/gh-action-pypi-publish/blob/v1.8.14/action.yml#L15 ### `.pre-commit-config.yaml`: * Added some pre-commit hooks for formatting and validating `pyproject.toml` ### `MANIFEST.in`: * Removed `MANIFEST.in`, as the default `[tool.hatch.build.targets.sdist]` configuration (in `pyproject.toml`) includes all files not ignored through our `.gitignore`; see https://hatch.pypa.io/latest/plugins/builder/sdist/#default-file-selection ### `pyproject.toml`: * Didn't include the `license` field, as the docs recommend using a `License ::` classifier instead - see https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license * The classifier "Programming Language :: Python :: 3" was changed to "Programming Language :: Python :: 3 :: Only" by the `pyproject-fmt` pre-commit hook * Set `core-metadata-version = "2.2"` (copied from https://github.com/jazzband/django-debug-toolbar/pull/1916) due to https://github.com/jazzband/help/issues/360 * Didn't include the last 3 packages from the `packages` kwarg in `setup.py` when configuring `[tool.hatch.build.targets.wheel]`, since they don't make any difference in the generated wheel, as having just `simple_history` will include all its subpackages * As part of porting long_description's file concatenation from `setup.py`, `hatch-fancy-pypi-readme` was added to `requires` and configured to concatenate the same files - except with the first title of `README.rst` and the "Unreleased" section of `CHANGES.rst` removed (facilitated by the added "Start of PyPI readme" comments in those two files) --- .github/workflows/release.yml | 10 ++-- .github/workflows/test.yml | 2 +- .pre-commit-config.yaml | 10 ++++ CHANGES.rst | 5 ++ MANIFEST.in | 6 --- README.rst | 2 + pyproject.toml | 92 +++++++++++++++++++++++++++++++++-- setup.py | 54 -------------------- tox.ini | 4 +- 9 files changed, 113 insertions(+), 72 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..677591269 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 ad2a9b134..5b95a9e6e 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 d93e4d7aa..2e4e384a5 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 3766fad38..9d638095c 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 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/README.rst b/README.rst index 9e872a1db..f054be6e8 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 52fb6e38c..36d123e6b 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 f70b05faa..000000000 --- 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 e5b11214a..663be4c8e 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]