Skip to content

Commit

Permalink
Migrated setuptools configuration to pyproject.toml.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
claudep and ngnpope authored Jun 24, 2024
1 parent 3ac0e43 commit 4686541
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 143 deletions.
9 changes: 9 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[flake8]
exclude = build,.git,.tox,./tests/.env
extend-ignore = E203
max-line-length = 88
per-file-ignores =
django/core/cache/backends/filebased.py:W601
django/core/cache/backends/base.py:W601
django/core/cache/backends/redis.py:W601
tests/cache/tests.py:W601
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ graft extras
graft js_tests
graft scripts
graft tests
global-exclude __pycache__
global-exclude *.py[co]
2 changes: 1 addition & 1 deletion docs/internals/contributing/writing-code/coding-style.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Python style
* Unless otherwise specified, follow :pep:`8`.

Use :pypi:`flake8` to check for problems in this area. Note that our
``setup.cfg`` file contains some excluded files (deprecated modules we don't
``.flake8`` file contains some excluded files (deprecated modules we don't
care about cleaning up and some third-party code that Django vendors) as well
as some excluded errors that we don't consider as gross violations. Remember
that :pep:`8` is only a guide, so respect the style of the surrounding code
Expand Down
15 changes: 8 additions & 7 deletions docs/internals/howto-release-django.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ permissions.

.. code-block:: shell

$ python -m pip install wheel twine
$ python -m pip install build twine

* Access to `Django's project on PyPI <https://pypi.org/project/Django/>`_ to
upload binaries, ideally with extra permissions to `yank a release
Expand Down Expand Up @@ -345,10 +345,11 @@ issuing **multiple releases**, repeat these steps for each release.
<2719a7f8c161233f45d34b624a9df9392c86cc1b>`).

#. If this is a pre-release package also update the "Development Status"
trove classifier in ``setup.cfg`` to reflect this. An ``rc`` pre-release
should not change the trove classifier (:commit:`example commit for alpha
release <eeeacc52a967234e920c001b7908c4acdfd7a848>`, :commit:`example
commit for beta release <25fec8940b24107e21314ab6616e18ce8dec1c1c>`).
trove classifier in ``pyproject.toml`` to reflect this. An ``rc``
pre-release should not change the trove classifier (:commit:`example
commit for alpha release <eeeacc52a967234e920c001b7908c4acdfd7a848>`,
:commit:`example commit for beta release
<25fec8940b24107e21314ab6616e18ce8dec1c1c>`).

#. Otherwise, make sure the classifier is set to
``Development Status :: 5 - Production/Stable``.
Expand All @@ -370,8 +371,8 @@ issuing **multiple releases**, repeat these steps for each release.

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

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

#. Generate the hashes of the release packages:

Expand Down
4 changes: 2 additions & 2 deletions docs/topics/auth/passwords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ To use Argon2id as your default storage algorithm, do the following:
#. Install the :pypi:`argon2-cffi` package. This can be done by running
``python -m pip install django[argon2]``, which is equivalent to
``python -m pip install argon2-cffi`` (along with any version requirement
from Django's ``setup.cfg``).
from Django's ``pyproject.toml``).

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

#. Modify :setting:`PASSWORD_HASHERS` to list ``BCryptSHA256PasswordHasher``
first. That is, in your settings file, you'd put::
Expand Down
9 changes: 0 additions & 9 deletions extras/Makefile

This file was deleted.

70 changes: 63 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,68 @@
[build-system]
requires = ['setuptools>=40.8.0']
build-backend = 'setuptools.build_meta'
requires = ["setuptools>=61.0.0,<69.3.0"]
build-backend = "setuptools.build_meta"

[project]
name = "Django"
dynamic = ["version"]
requires-python = ">= 3.10"
dependencies = [
"asgiref>=3.7.0",
"sqlparse>=0.3.1",
"tzdata; sys_platform == 'win32'",
]
authors = [
{name = "Django Software Foundation", email = "[email protected]"},
]
description = "A high-level Python web framework that encourages rapid development and clean, pragmatic design."
readme = "README.rst"
license = {text = "BSD-3-Clause"}
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Environment :: Web Environment",
"Framework :: Django",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Internet :: WWW/HTTP :: WSGI",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Topic :: Software Development :: Libraries :: Python Modules",
]

[project.optional-dependencies]
argon2 = ["argon2-cffi>=19.1.0"]
bcrypt = ["bcrypt"]

[project.scripts]
django-admin = "django.core.management:execute_from_command_line"

[project.urls]
Homepage = "https://www.djangoproject.com/"
Documentation = "https://docs.djangoproject.com/"
"Release notes" = "https://docs.djangoproject.com/en/stable/releases/"
Funding = "https://www.djangoproject.com/fundraising/"
Source = "https://github.com/django/django"
Tracker = "https://code.djangoproject.com/"

[tool.black]
target-version = ['py310']
force-exclude = 'tests/test_runner_apps/tagged/tests_syntax_error.py'
target-version = ["py310"]
force-exclude = "tests/test_runner_apps/tagged/tests_syntax_error.py"

[tool.isort]
profile = 'black'
default_section = 'THIRDPARTY'
known_first_party = 'django'
profile = "black"
default_section = "THIRDPARTY"
known_first_party = "django"

[tool.setuptools.dynamic]
version = {attr = "django.__version__"}

[tool.setuptools.packages.find]
include = ["django*"]
61 changes: 0 additions & 61 deletions setup.cfg

This file was deleted.

55 changes: 0 additions & 55 deletions setup.py

This file was deleted.

0 comments on commit 4686541

Please sign in to comment.