Skip to content

Commit afe52d8

Browse files
claudepnessita
authored andcommitted
[4.2.x] Migrated setuptools configuration to pyproject.toml.
This branch migrates setuptools configuration from setup.py/setup.cfg to pyproject.toml. In order to ensure that the generated binary files have consistent casing (both the tarball and the wheel), setuptools version is limited to ">=61.0.0,<69.3.0". Configuration for flake8 was moved to a dedicated .flake8 file since it cannot be configured via pyproject.toml. Also, __pycache__ exclusion was removed from MANIFEST and the extras/Makefile was replaced with a simpler build command. Co-authored-by: Nick Pope <nick@nickpope.me.uk> Backport of 4686541 from main.
1 parent 35c34ed commit afe52d8

File tree

9 files changed

+92
-147
lines changed

9 files changed

+92
-147
lines changed

.flake8

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[flake8]
2+
exclude = build,.git,.tox,./tests/.env
3+
extend-ignore = E203
4+
max-line-length = 88
5+
per-file-ignores =
6+
django/core/cache/backends/filebased.py:W601
7+
django/core/cache/backends/base.py:W601
8+
django/core/cache/backends/redis.py:W601
9+
tests/cache/tests.py:W601

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ graft extras
1212
graft js_tests
1313
graft scripts
1414
graft tests
15-
global-exclude __pycache__
1615
global-exclude *.py[co]

docs/internals/contributing/writing-code/coding-style.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Python style
4646
* Unless otherwise specified, follow :pep:`8`.
4747

4848
Use :pypi:`flake8` to check for problems in this area. Note that our
49-
``setup.cfg`` file contains some excluded files (deprecated modules we don't
49+
``.flake8`` file contains some excluded files (deprecated modules we don't
5050
care about cleaning up and some third-party code that Django vendors) as well
5151
as some excluded errors that we don't consider as gross violations. Remember
5252
that :pep:`8` is only a guide, so respect the style of the surrounding code

docs/internals/howto-release-django.txt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ You'll need a few things before getting started:
5858

5959
.. code-block:: shell
6060

61-
$ python -m pip install wheel twine
61+
$ python -m pip install build twine
6262

6363
* Access to Django's record on PyPI. Create a file with your credentials:
6464

@@ -222,9 +222,15 @@ OK, this is the fun part, where we actually push out a release!
222222
Please see `notes on setting the VERSION tuple`_ below for details
223223
on ``VERSION``.
224224

225-
#. If this is a pre-release package, update the "Development Status" trove
226-
classifier in ``setup.cfg`` to reflect this. Otherwise, make sure the
227-
classifier is set to ``Development Status :: 5 - Production/Stable``.
225+
#. If this is a pre-release package also update the "Development Status"
226+
trove classifier in ``pyproject.toml`` to reflect this. An ``rc``
227+
pre-release should not change the trove classifier (:commit:`example
228+
commit for alpha release <eeeacc52a967234e920c001b7908c4acdfd7a848>`,
229+
:commit:`example commit for beta release
230+
<25fec8940b24107e21314ab6616e18ce8dec1c1c>`).
231+
232+
#. Otherwise, make sure the classifier is set to
233+
``Development Status :: 5 - Production/Stable``.
228234

229235
#. Tag the release using ``git tag``. For example:
230236

@@ -238,8 +244,8 @@ OK, this is the fun part, where we actually push out a release!
238244

239245
#. Make sure you have an absolutely clean tree by running ``git clean -dfx``.
240246

241-
#. Run ``make -f extras/Makefile`` to generate the release packages. This will
242-
create the release packages in a ``dist/`` directory.
247+
#. Run ``python -m build`` to generate the release packages. This will create
248+
the release packages in a ``dist/`` directory.
243249

244250
#. Generate the hashes of the release packages:
245251

docs/topics/auth/passwords.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ To use Argon2id as your default storage algorithm, do the following:
9797
#. Install the :pypi:`argon2-cffi` package. This can be done by running
9898
``python -m pip install django[argon2]``, which is equivalent to
9999
``python -m pip install argon2-cffi`` (along with any version requirement
100-
from Django's ``setup.cfg``).
100+
from Django's ``pyproject.toml``).
101101

102102
#. Modify :setting:`PASSWORD_HASHERS` to list ``Argon2PasswordHasher`` first.
103103
That is, in your settings file, you'd put::
@@ -128,7 +128,7 @@ To use Bcrypt as your default storage algorithm, do the following:
128128
#. Install the :pypi:`bcrypt` package. This can be done by running
129129
``python -m pip install django[bcrypt]``, which is equivalent to
130130
``python -m pip install bcrypt`` (along with any version requirement from
131-
Django's ``setup.cfg``).
131+
Django's ``pyproject.toml``).
132132

133133
#. Modify :setting:`PASSWORD_HASHERS` to list ``BCryptSHA256PasswordHasher``
134134
first. That is, in your settings file, you'd put::

extras/Makefile

Lines changed: 0 additions & 9 deletions
This file was deleted.

pyproject.toml

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,71 @@
11
[build-system]
2-
requires = ['setuptools>=40.8.0']
3-
build-backend = 'setuptools.build_meta'
2+
requires = ["setuptools>=61.0.0,<69.3.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "Django"
7+
dynamic = ["version"]
8+
requires-python = ">= 3.8"
9+
dependencies = [
10+
"asgiref >= 3.6.0, < 4",
11+
"backports.zoneinfo; python_version<'3.9'",
12+
"sqlparse>=0.3.1",
13+
"tzdata; sys_platform == 'win32'",
14+
]
15+
authors = [
16+
{name = "Django Software Foundation", email = "foundation@djangoproject.com"},
17+
]
18+
description = "A high-level Python web framework that encourages rapid development and clean, pragmatic design."
19+
readme = "README.rst"
20+
license = {text = "BSD-3-Clause"}
21+
classifiers = [
22+
"Development Status :: 5 - Production/Stable",
23+
"Environment :: Web Environment",
24+
"Framework :: Django",
25+
"Intended Audience :: Developers",
26+
"License :: OSI Approved :: BSD License",
27+
"Operating System :: OS Independent",
28+
"Programming Language :: Python",
29+
"Programming Language :: Python :: 3",
30+
"Programming Language :: Python :: 3 :: Only",
31+
"Programming Language :: Python :: 3.8",
32+
"Programming Language :: Python :: 3.9",
33+
"Programming Language :: Python :: 3.10",
34+
"Programming Language :: Python :: 3.11",
35+
"Programming Language :: Python :: 3.12",
36+
"Topic :: Internet :: WWW/HTTP",
37+
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
38+
"Topic :: Internet :: WWW/HTTP :: WSGI",
39+
"Topic :: Software Development :: Libraries :: Application Frameworks",
40+
"Topic :: Software Development :: Libraries :: Python Modules",
41+
]
42+
43+
[project.optional-dependencies]
44+
argon2 = ["argon2-cffi>=19.1.0"]
45+
bcrypt = ["bcrypt"]
46+
47+
[project.scripts]
48+
django-admin = "django.core.management:execute_from_command_line"
49+
50+
[project.urls]
51+
Homepage = "https://www.djangoproject.com/"
52+
Documentation = "https://docs.djangoproject.com/"
53+
"Release notes" = "https://docs.djangoproject.com/en/stable/releases/"
54+
Funding = "https://www.djangoproject.com/fundraising/"
55+
Source = "https://github.com/django/django"
56+
Tracker = "https://code.djangoproject.com/"
457

558
[tool.black]
6-
target-version = ['py38']
7-
force-exclude = 'tests/test_runner_apps/tagged/tests_syntax_error.py'
59+
target-version = ["py38"]
60+
force-exclude = "tests/test_runner_apps/tagged/tests_syntax_error.py"
61+
62+
[tool.isort]
63+
profile = "black"
64+
default_section = "THIRDPARTY"
65+
known_first_party = "django"
66+
67+
[tool.setuptools.dynamic]
68+
version = {attr = "django.__version__"}
69+
70+
[tool.setuptools.packages.find]
71+
include = ["django*"]

setup.cfg

Lines changed: 0 additions & 69 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)