Skip to content

Commit

Permalink
Merge branch 'ddabble/update-package-metadata' into modernize-metadata
Browse files Browse the repository at this point in the history
# 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
  jazzband#1348 (comment)

Changes in `tox.ini`:
* Removed `isolated_build`, as isolated build environments are enabled
  by default from tox v4 - see
  jazzband#1348 (comment)
  • Loading branch information
ddabble committed May 29, 2024
2 parents 35c540e + fef00f6 commit 19722e2
Show file tree
Hide file tree
Showing 13 changed files with 129 additions and 125 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ jobs:
- 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
10 changes: 1 addition & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 8 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ Changes
Unreleased
----------

- Update package metadata to use modern standards

- 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)
------------------
Expand Down
47 changes: 25 additions & 22 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
django-simple-history
=====================
django-simple-history |pypi-version|
====================================

.. image:: https://github.com/jazzband/django-simple-history/actions/workflows/test.yml/badge.svg
.. 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
: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:

========== ========================
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
Expand All @@ -50,9 +53,9 @@ 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
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
Expand Down
1 change: 0 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
92 changes: 54 additions & 38 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,76 +1,85 @@
[build-system]
requires = ["hatchling", "hatch-vcs", "hatch-fancy-pypi-readme"]
build-backend = "hatchling.build"
requires = [
"hatch-fancy-pypi-readme",
"hatch-vcs",
"hatchling",
]

[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 = "[email protected]" },
]
maintainers = [
{ name = "Trey Hunner" },
]
authors = [
{ name = "Corey Bertram", email = "[email protected]" },
]
requires-python = ">=3.8"
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 :: 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",
"Programming Language :: Python :: 3.13",
# DEV: uncomment this when the `pyproject-fmt` pre-commit hook stops removing it
#"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"
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 = "post-release"
version_scheme = "no-guess-dev"
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"]
# Jazzband's release process is limited to 2.2 metadata
# - see https://github.com/jazzband/help/issues/360
core-metadata-version = "2.2"
packages = [
"simple_history",
]

[tool.hatch.build.targets.sdist]
include = [
"/docs",
"/simple_history",
"*.rst",
"*.txt",
# Jazzband's release process is limited to 2.2 metadata
# - see https://github.com/jazzband/help/issues/360
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"
Expand All @@ -79,12 +88,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/*",
]
5 changes: 1 addition & 4 deletions requirements/postgres.txt
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
-r ./coverage.txt
# DEV: Remove this requirement entirely when the minimum required Django version is 4.2
asgiref>=3.6
16 changes: 6 additions & 10 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand All @@ -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 {
Expand Down
Loading

0 comments on commit 19722e2

Please sign in to comment.