Skip to content

Commit 19722e2

Browse files
committed
Merge branch 'ddabble/update-package-metadata' into modernize-metadata
# Conflicts: # .github/workflows/release.yml # CHANGES.rst # pyproject.toml Changes in `pyproject.toml`: * Removed `license`, for the reason stated in fef00f6 * Removed duplicate "Framework :: Django" classifier (originating from `setup.py`) * Replaced `version_scheme` with "no-guess-dev", which is the docs' recommended replacement for "post-release" - which is deprecated (see https://setuptools-scm.readthedocs.io/en/stable/extending/#available-implementations) * Removed `include`, as the default configuration includes all files not ignored through our `.gitignore` (see https://hatch.pypa.io/latest/plugins/builder/sdist/#default-file-selection), which is what we want in the source distribution (sdist) * Added link to issue in the comments on the `core-metadata-version` fields - see #1348 (comment) Changes in `tox.ini`: * Removed `isolated_build`, as isolated build environments are enabled by default from tox v4 - see #1348 (comment)
2 parents 35c540e + fef00f6 commit 19722e2

File tree

13 files changed

+129
-125
lines changed

13 files changed

+129
-125
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ jobs:
3333
3434
- name: Upload packages to Jazzband
3535
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
36-
uses: pypa/gh-action-pypi-publish@master
36+
uses: pypa/gh-action-pypi-publish@release/v1
3737
with:
3838
user: jazzband
3939
password: ${{ secrets.JAZZBAND_RELEASE_KEY }}
40-
repository_url: https://jazzband.co/projects/django-simple-history/upload
40+
repository-url: https://jazzband.co/projects/django-simple-history/upload

.github/workflows/test.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13-dev']
15-
django-version: ['3.2', '4.2', '5.0', 'main']
15+
django-version: ['4.2', '5.0', 'main']
1616

1717
exclude:
1818
# Exclude py3.8 and py3.9 for Django main and 5.0
@@ -25,14 +25,6 @@ jobs:
2525
- python-version: '3.9'
2626
django-version: 'main'
2727

28-
# Exclude py3.11, py3.12 and py3.13 for Django 3.2
29-
- python-version: '3.11'
30-
django-version: '3.2'
31-
- python-version: '3.12'
32-
django-version: '3.2'
33-
- python-version: '3.13-dev'
34-
django-version: '3.2'
35-
3628
services:
3729

3830
postgres:

.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,19 @@ repos:
3535
- id: check-docstring-first
3636
- id: check-executables-have-shebangs
3737
- id: check-merge-conflict
38+
- id: check-toml
3839
- id: debug-statements
3940
- id: detect-private-key
4041

42+
- repo: https://github.com/tox-dev/pyproject-fmt
43+
rev: 2.1.3
44+
hooks:
45+
- id: pyproject-fmt
46+
- repo: https://github.com/abravalheri/validate-pyproject
47+
rev: v0.18
48+
hooks:
49+
- id: validate-pyproject
50+
4151
- repo: https://github.com/adrienverge/yamllint
4252
rev: v1.35.1
4353
hooks:

CHANGES.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ Changes
44
Unreleased
55
----------
66

7-
- Update package metadata to use modern standards
8-
7+
- Dropped support for Django 3.2, which reached end-of-life on 2024-04-01 (gh-1344)
8+
- Removed the temporary requirement on ``asgiref>=3.6`` added in 3.5.0,
9+
now that the minimum required Django version is 4.2 (gh-1344)
10+
- Migrated package building from using the deprecated ``setup.py`` to using
11+
``pyproject.toml`` (with Hatchling as build backend);
12+
``setup.py`` has consequently been removed (gh-1348)
13+
14+
.. Start of PyPI readme
915
1016
3.6.0 (2024-05-26)
1117
------------------

README.rst

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,50 @@
1-
django-simple-history
2-
=====================
1+
django-simple-history |pypi-version|
2+
====================================
33

4-
.. image:: https://github.com/jazzband/django-simple-history/actions/workflows/test.yml/badge.svg
4+
.. Start of PyPI readme
5+
6+
|jazzband| |build-status| |docs| |coverage| |maintainability| |code-style| |downloads|
7+
8+
.. |pypi-version| image:: https://img.shields.io/pypi/v/django-simple-history.svg
9+
:target: https://pypi.org/project/django-simple-history/
10+
:alt: PyPI Version
11+
12+
.. |jazzband| image:: https://jazzband.co/static/img/badge.svg
13+
:target: https://jazzband.co/
14+
:alt: Jazzband
15+
16+
.. |build-status| image:: https://github.com/jazzband/django-simple-history/actions/workflows/test.yml/badge.svg
517
:target: https://github.com/jazzband/django-simple-history/actions/workflows/test.yml
618
:alt: Build Status
719

8-
.. image:: https://readthedocs.org/projects/django-simple-history/badge/?version=latest
20+
.. |docs| image:: https://readthedocs.org/projects/django-simple-history/badge/?version=latest
921
:target: https://django-simple-history.readthedocs.io/en/latest/?badge=latest
1022
:alt: Documentation Status
1123

12-
.. image:: https://img.shields.io/codecov/c/github/jazzband/django-simple-history/master.svg
24+
.. |coverage| image:: https://img.shields.io/codecov/c/github/jazzband/django-simple-history/master.svg
1325
:target: https://app.codecov.io/github/jazzband/django-simple-history?branch=master
1426
:alt: Test Coverage
1527

16-
.. image:: https://img.shields.io/pypi/v/django-simple-history.svg
17-
:target: https://pypi.org/project/django-simple-history/
18-
:alt: PyPI Version
19-
20-
.. image:: https://api.codeclimate.com/v1/badges/66cfd94e2db991f2d28a/maintainability
28+
.. |maintainability| image:: https://api.codeclimate.com/v1/badges/66cfd94e2db991f2d28a/maintainability
2129
:target: https://codeclimate.com/github/jazzband/django-simple-history/maintainability
2230
:alt: Maintainability
2331

24-
.. image:: https://static.pepy.tech/badge/django-simple-history
25-
:target: https://pepy.tech/project/django-simple-history
26-
:alt: Downloads
27-
28-
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
32+
.. |code-style| image:: https://img.shields.io/badge/code%20style-black-000000.svg
2933
:target: https://github.com/psf/black
3034
:alt: Code Style
3135

32-
.. image:: https://jazzband.co/static/img/badge.svg
33-
:target: https://jazzband.co/
34-
:alt: Jazzband
36+
.. |downloads| image:: https://static.pepy.tech/badge/django-simple-history
37+
:target: https://pepy.tech/project/django-simple-history
38+
:alt: Downloads
3539

3640

37-
django-simple-history stores Django model state on every create/update/delete.
41+
``django-simple-history`` stores Django model state on every create/update/delete.
3842

3943
This app supports the following combinations of Django and Python:
4044

4145
========== ========================
4246
Django Python
4347
========== ========================
44-
3.2 3.8, 3.9, 3.10
4548
4.2 3.8, 3.9, 3.10, 3.11, 3.12, 3.13-dev
4649
5.0 3.10, 3.11, 3.12, 3.13-dev
4750
main 3.10, 3.11, 3.12, 3.13-dev
@@ -50,9 +53,9 @@ main 3.10, 3.11, 3.12, 3.13-dev
5053
Getting Help
5154
------------
5255

53-
Documentation is available at https://django-simple-history.readthedocs.io/
56+
Documentation is available at https://django-simple-history.readthedocs.io/en/stable/
5457

55-
Pull requests are welcome. Read the `CONTRIBUTING`_ file for tips on
58+
Pull requests are welcome. Read the `CONTRIBUTING`_ file for tips on
5659
submitting a pull request.
5760

5861
.. _CONTRIBUTING: https://github.com/jazzband/django-simple-history/blob/master/CONTRIBUTING.rst

docs/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ This app supports the following combinations of Django and Python:
4141
========== =======================
4242
Django Python
4343
========== =======================
44-
3.2 3.8, 3.9, 3.10
4544
4.2 3.8, 3.9, 3.10, 3.11, 3.12, 3.13-dev
4645
5.0 3.10, 3.11, 3.12, 3.13-dev
4746
main 3.10, 3.11, 3.12, 3.13-dev

pyproject.toml

Lines changed: 54 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,85 @@
11
[build-system]
2-
requires = ["hatchling", "hatch-vcs", "hatch-fancy-pypi-readme"]
32
build-backend = "hatchling.build"
3+
requires = [
4+
"hatch-fancy-pypi-readme",
5+
"hatch-vcs",
6+
"hatchling",
7+
]
48

59
[project]
610
name = "django-simple-history"
7-
dynamic = ["version", "readme"]
811
description = "Store model history and view/revert changes from admin site."
9-
license = "BSD-3-Clause"
10-
requires-python = ">=3.8"
11-
authors = [
12-
{ name = "Corey Bertram", email = "[email protected]" },
13-
]
1412
maintainers = [
1513
{ name = "Trey Hunner" },
1614
]
15+
authors = [
16+
{ name = "Corey Bertram", email = "[email protected]" },
17+
]
18+
requires-python = ">=3.8"
1719
classifiers = [
1820
"Development Status :: 5 - Production/Stable",
1921
"Environment :: Web Environment",
2022
"Framework :: Django",
21-
"Framework :: Django",
22-
"Framework :: Django :: 3.2",
2323
"Framework :: Django :: 4.2",
2424
"Framework :: Django :: 5.0",
2525
"Intended Audience :: Developers",
2626
"License :: OSI Approved :: BSD License",
2727
"Programming Language :: Python",
28-
"Programming Language :: Python :: 3",
28+
"Programming Language :: Python :: 3 :: Only",
2929
"Programming Language :: Python :: 3.8",
3030
"Programming Language :: Python :: 3.9",
3131
"Programming Language :: Python :: 3.10",
3232
"Programming Language :: Python :: 3.11",
3333
"Programming Language :: Python :: 3.12",
34-
"Programming Language :: Python :: 3.13",
34+
# DEV: uncomment this when the `pyproject-fmt` pre-commit hook stops removing it
35+
#"Programming Language :: Python :: 3.13",
3536
]
36-
# DEV: Remove `asgiref` when the minimum required Django version is 4.2
37-
dependencies = ["asgiref>=3.6"]
38-
39-
[project.urls]
40-
Changelog = "https://github.com/jazzband/django-simple-history/blob/master/CHANGES.rst"
41-
Documentation = "https://django-simple-history.readthedocs.io/"
42-
Source = "https://github.com/jazzband/django-simple-history"
43-
Tracker = "https://github.com/jazzband/django-simple-history/issues"
37+
dynamic = [
38+
"readme",
39+
"version",
40+
]
41+
dependencies = [
42+
]
43+
urls.Changelog = "https://github.com/jazzband/django-simple-history/blob/master/CHANGES.rst"
44+
urls.Documentation = "https://django-simple-history.readthedocs.io/en/stable/"
45+
urls.Homepage = "https://github.com/jazzband/django-simple-history"
46+
urls.Source = "https://github.com/jazzband/django-simple-history"
47+
urls.Tracker = "https://github.com/jazzband/django-simple-history/issues"
4448

4549
[tool.hatch.version]
4650
source = "vcs"
51+
fallback-version = "0.0.0"
4752

4853
[tool.hatch.version.raw-options]
49-
version_scheme = "post-release"
54+
version_scheme = "no-guess-dev"
5055
local_scheme = "node-and-date"
51-
fallback_version = "0.0.0"
52-
53-
[tool.hatch.metadata.hooks.fancy-pypi-readme]
54-
content-type = "text/x-rst"
55-
fragments = [
56-
{ path = "README.rst" },
57-
{ path = "CHANGES.rst" },
58-
]
5956

6057
[tool.hatch.build.targets.wheel]
61-
packages = ["simple_history"]
58+
# Jazzband's release process is limited to 2.2 metadata
59+
# - see https://github.com/jazzband/help/issues/360
60+
core-metadata-version = "2.2"
61+
packages = [
62+
"simple_history",
63+
]
6264

6365
[tool.hatch.build.targets.sdist]
64-
include = [
65-
"/docs",
66-
"/simple_history",
67-
"*.rst",
68-
"*.txt",
66+
# Jazzband's release process is limited to 2.2 metadata
67+
# - see https://github.com/jazzband/help/issues/360
68+
core-metadata-version = "2.2"
69+
70+
[tool.hatch.metadata.hooks.fancy-pypi-readme]
71+
content-type = "text/x-rst"
72+
fragments = [
73+
{ path = "README.rst", start-after = ".. Start of PyPI readme\n\n" },
74+
{ text = "\n====\n\nChangelog\n=========\n\n" },
75+
{ path = "CHANGES.rst", start-after = ".. Start of PyPI readme\n\n" },
6976
]
7077

7178
[tool.black]
7279
line-length = 88
73-
target-version = ["py38"]
80+
target-version = [
81+
"py38",
82+
]
7483

7584
[tool.isort]
7685
profile = "black"
@@ -79,12 +88,19 @@ py_version = "38"
7988
[tool.coverage.run]
8089
parallel = true
8190
branch = true
82-
source = ["simple_history"]
91+
source = [
92+
"simple_history",
93+
]
8394

8495
[tool.coverage.paths]
85-
source = ["simple_history", ".tox/*/site-packages"]
96+
source = [
97+
"simple_history",
98+
".tox/*/site-packages",
99+
]
86100

87101
[tool.coverage.report]
88102
show_missing = true
89103
skip_covered = true
90-
omit = ["requirements/*"]
104+
omit = [
105+
"requirements/*",
106+
]

requirements/postgres.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
# DEV: Replace this with `psycopg[binary]` when the minimum required Django version is
2-
# 4.2 or higher, as this is likely to be deprecated in the future
3-
# (see https://docs.djangoproject.com/en/4.2/releases/4.2/#psycopg-3-support)
4-
psycopg2-binary==2.9.9
1+
psycopg[binary]==3.1.19

requirements/test.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
-r ./coverage.txt
2-
# DEV: Remove this requirement entirely when the minimum required Django version is 4.2
3-
asgiref>=3.6

runtests.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ def __getitem__(self, item):
135135
},
136136
}
137137
],
138+
STORAGES={
139+
"default": {
140+
# Speeds up tests and prevents locally storing files created through them
141+
"BACKEND": "django.core.files.storage.InMemoryStorage",
142+
},
143+
},
138144
DEFAULT_AUTO_FIELD="django.db.models.AutoField",
139145
USE_TZ=False,
140146
)
@@ -146,16 +152,6 @@ def __getitem__(self, item):
146152

147153
DEFAULT_SETTINGS["MIDDLEWARE"] = MIDDLEWARE
148154

149-
# DEV: Merge these settings into DEFAULT_SETTINGS when the minimum required
150-
# Django version is 4.2 or higher
151-
if django.VERSION >= (4, 2):
152-
DEFAULT_SETTINGS["STORAGES"] = {
153-
"default": {
154-
# Speeds up tests and prevents locally storing files created through them
155-
"BACKEND": "django.core.files.storage.InMemoryStorage",
156-
},
157-
}
158-
159155

160156
def get_default_settings(*, database_name=DEFAULT_DATABASE_NAME):
161157
return {

0 commit comments

Comments
 (0)