From 31369964a42bcef90e4a644f23df601d789b28ce Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Thu, 27 Jul 2023 15:37:57 +0200 Subject: [PATCH 01/24] migrate setup.cfg to setup.py --- setup.cfg | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/setup.cfg b/setup.cfg index 487d99db91..9cadd95054 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,54 @@ [metadata] license_files = LICENSE.md +name = djangorestframework +version = 3.14.0 +author = Tom Christie +author_email = tom@tomchristie.com +license = BSD +description = Web APIs for Django, made easy. +url = https://www.django-rest-framework.org/ +long_description = file: README.md +long_description_content_type = text/markdown +classifiers = + Development Status :: 5 - Production/Stable + Environment :: Web Environment + Framework :: Django + Framework :: Django :: 3.0 + Framework :: Django :: 3.1 + Framework :: Django :: 3.2 + Framework :: Django :: 4.0 + Framework :: Django :: 4.1 + Framework :: Django :: 4.2 + Intended Audience :: Developers + License :: OSI Approved :: BSD License + Operating System :: OS Independent + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + 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 :: Only + Topic :: Internet :: WWW/HTTP +project_urls = + Funding = https://fund.django-rest-framework.org/topics/funding/ + Source = https://github.com/encode/django-rest-framework + Changelog = https://www.django-rest-framework.org/community/release-notes/ + +[options] +packages = find: +zip_safe = False +install_requires = + django>=3.0 + backports.zoneinfo;python_version<"3.9" +include_package_data = True +python_requires = >=3.6 + +[options.packages.find] +exclude = tests* [tool:pytest] addopts=--tb=short --strict-markers -ra From 401de876125c664dc8a6ce4447cba88994230fd5 Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Thu, 27 Jul 2023 15:51:51 +0200 Subject: [PATCH 02/24] restore a setup.py stub --- setup.py | 125 ------------------------------------------------------- 1 file changed, 125 deletions(-) delete mode 100755 setup.py diff --git a/setup.py b/setup.py deleted file mode 100755 index 682c6c491d..0000000000 --- a/setup.py +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env python3 -import os -import re -import shutil -import sys -from io import open - -from setuptools import find_packages, setup - -CURRENT_PYTHON = sys.version_info[:2] -REQUIRED_PYTHON = (3, 6) - -# This check and everything above must remain compatible with Python 2.7. -if CURRENT_PYTHON < REQUIRED_PYTHON: - sys.stderr.write(""" -========================== -Unsupported Python version -========================== - -This version of Django REST Framework requires Python {}.{}, but you're trying -to install it on Python {}.{}. - -This may be because you are using a version of pip that doesn't -understand the python_requires classifier. Make sure you -have pip >= 9.0 and setuptools >= 24.2, then try again: - - $ python -m pip install --upgrade pip setuptools - $ python -m pip install djangorestframework - -This will install the latest version of Django REST Framework which works on -your version of Python. If you can't upgrade your pip (or Python), request -an older version of Django REST Framework: - - $ python -m pip install "djangorestframework<3.10" -""".format(*(REQUIRED_PYTHON + CURRENT_PYTHON))) - sys.exit(1) - - -def read(f): - with open(f, 'r', encoding='utf-8') as file: - return file.read() - - -def get_version(package): - """ - Return package version as listed in `__version__` in `init.py`. - """ - init_py = open(os.path.join(package, '__init__.py')).read() - return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1) - - -version = get_version('rest_framework') - - -if sys.argv[-1] == 'publish': - if os.system("pip freeze | grep twine"): - print("twine not installed.\nUse `pip install twine`.\nExiting.") - sys.exit() - os.system("python setup.py sdist bdist_wheel") - if os.system("twine check dist/*"): - print("twine check failed. Packages might be outdated.") - print("Try using `pip install -U twine wheel`.\nExiting.") - sys.exit() - os.system("twine upload dist/*") - print("You probably want to also tag the version now:") - print(" git tag -a %s -m 'version %s'" % (version, version)) - print(" git push --tags") - shutil.rmtree('dist') - shutil.rmtree('build') - shutil.rmtree('djangorestframework.egg-info') - sys.exit() - - -setup( - name='djangorestframework', - version=version, - url='https://www.django-rest-framework.org/', - license='BSD', - description='Web APIs for Django, made easy.', - long_description=read('README.md'), - long_description_content_type='text/markdown', - author='Tom Christie', - author_email='tom@tomchristie.com', # SEE NOTE BELOW (*) - packages=find_packages(exclude=['tests*']), - include_package_data=True, - install_requires=["django>=3.0", 'backports.zoneinfo;python_version<"3.9"'], - python_requires=">=3.6", - zip_safe=False, - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Web Environment', - 'Framework :: Django', - 'Framework :: Django :: 3.0', - 'Framework :: Django :: 3.1', - 'Framework :: Django :: 3.2', - 'Framework :: Django :: 4.0', - 'Framework :: Django :: 4.1', - 'Framework :: Django :: 4.2', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - '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 :: Only', - 'Topic :: Internet :: WWW/HTTP', - ], - project_urls={ - 'Funding': 'https://fund.django-rest-framework.org/topics/funding/', - 'Source': 'https://github.com/encode/django-rest-framework', - 'Changelog': 'https://www.django-rest-framework.org/community/release-notes/', - }, -) - -# (*) Please direct queries to the discussion group, rather than to me directly -# Doing so helps ensure your question is helpful to other users. -# Queries directly to my email are likely to receive a canned response. -# -# Many thanks for your understanding. From 6019f1d9784d45ae386ba50daaa4cd26909d5520 Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Thu, 27 Jul 2023 15:56:07 +0200 Subject: [PATCH 03/24] migrate setup.cfg to pyproject.toml --- pyproject.toml | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 77 ------------------------------------------- 2 files changed, 89 insertions(+), 77 deletions(-) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..640ce32711 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,89 @@ +[build-system] +requires = ["setuptools>=61.2"] +build-backend = "setuptools.build_meta" + +[project] +name = "djangorestframework" +version = "3.14.0" +authors = [{name = "Tom Christie", email = "tom@tomchristie.com"}] +license = {text = "BSD"} +description = "Web APIs for Django, made easy." +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Framework :: Django", + "Framework :: Django :: 3.0", + "Framework :: Django :: 3.1", + "Framework :: Django :: 3.2", + "Framework :: Django :: 4.0", + "Framework :: Django :: 4.1", + "Framework :: Django :: 4.2", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "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 :: Only", + "Topic :: Internet :: WWW/HTTP", +] +requires-python = ">=3.6" +dependencies = [ + "django>=3.0", + 'backports.zoneinfo;python_version<"3.9"', +] + +[project.readme] +file = "README.md" +content-type = "text/markdown" + +[project.urls] +Homepage = "https://www.django-rest-framework.org/" +Funding = "https://fund.django-rest-framework.org/topics/funding/" +Source = "https://github.com/encode/django-rest-framework" +Changelog = "https://www.django-rest-framework.org/community/release-notes/" + +[tool.setuptools] +zip-safe = false +include-package-data = true +license-files = ["LICENSE.md"] + +[tool.setuptools.packages.find] +exclude = ["tests*"] +namespaces = false + +[tool.pytest.ini_options] +addopts = "--tb=short --strict-markers -ra" +testspath = "tests" +filterwarnings = ["ignore:CoreAPI compatibility is deprecated*:rest_framework.RemovedInDRF317Warning"] + +[tool.flake8] +ignore = "E501,W503,W504" +banned-modules = "json = use from rest_framework.utils import json!" + +[tool.isort] +skip = [".tox"] +atomic = true +multi_line_output = 5 +extra_standard_library = ["types"] +known_third_party = ["pytest", "_pytest", "django", "pytz", "uritemplate"] +known_first_party = ["rest_framework", "tests"] + +[tool.coverage.run] +# NOTE: source is ignored with pytest-cov (but uses the same). +source = ["."] +include = ["rest_framework/*", "tests/*"] +branch = true + +[tool.coverage.report] +include = ["rest_framework/*", "tests/*"] +exclude_lines = [ + "pragma: no cover", + "raise NotImplementedError", +] diff --git a/setup.cfg b/setup.cfg index 9cadd95054..aebdf53629 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,80 +1,3 @@ -[metadata] -license_files = LICENSE.md -name = djangorestframework -version = 3.14.0 -author = Tom Christie -author_email = tom@tomchristie.com -license = BSD -description = Web APIs for Django, made easy. -url = https://www.django-rest-framework.org/ -long_description = file: README.md -long_description_content_type = text/markdown -classifiers = - Development Status :: 5 - Production/Stable - Environment :: Web Environment - Framework :: Django - Framework :: Django :: 3.0 - Framework :: Django :: 3.1 - Framework :: Django :: 3.2 - Framework :: Django :: 4.0 - Framework :: Django :: 4.1 - Framework :: Django :: 4.2 - Intended Audience :: Developers - License :: OSI Approved :: BSD License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - 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 :: Only - Topic :: Internet :: WWW/HTTP -project_urls = - Funding = https://fund.django-rest-framework.org/topics/funding/ - Source = https://github.com/encode/django-rest-framework - Changelog = https://www.django-rest-framework.org/community/release-notes/ - -[options] -packages = find: -zip_safe = False -install_requires = - django>=3.0 - backports.zoneinfo;python_version<"3.9" -include_package_data = True -python_requires = >=3.6 - -[options.packages.find] -exclude = tests* - -[tool:pytest] -addopts=--tb=short --strict-markers -ra -testspath = tests -filterwarnings = ignore:CoreAPI compatibility is deprecated*:rest_framework.RemovedInDRF317Warning - [flake8] ignore = E501,W503,W504 banned-modules = json = use from rest_framework.utils import json! - -[isort] -skip=.tox -atomic=true -multi_line_output=5 -extra_standard_library=types -known_third_party=pytest,_pytest,django,pytz,uritemplate -known_first_party=rest_framework,tests - -[coverage:run] -# NOTE: source is ignored with pytest-cov (but uses the same). -source = . -include = rest_framework/*,tests/* -branch = 1 - -[coverage:report] -include = rest_framework/*,tests/* -exclude_lines = - pragma: no cover - raise NotImplementedError From 121caba60a057aec9dc929466a31e2edeeabc8e5 Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Sat, 29 Jul 2023 00:24:20 +0200 Subject: [PATCH 04/24] tox: isolated build --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 38682615f8..d4157860dd 100644 --- a/tox.ini +++ b/tox.ini @@ -9,6 +9,7 @@ envlist = base dist docs +isolated_build = true [testenv] commands = python -W error::DeprecationWarning -W error::PendingDeprecationWarning runtests.py --coverage {posargs} From c2062da2441e8c6e4e4a4e6e5d90c9ca610c7987 Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Sat, 29 Jul 2023 17:07:07 +0200 Subject: [PATCH 05/24] remove python 3.6 --- .github/workflows/main.yml | 10 ---------- pyproject.toml | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 756b6d24ba..e2ee00978d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,6 @@ jobs: strategy: matrix: python-version: - - '3.6' - '3.7' - '3.8' - '3.9' @@ -37,18 +36,9 @@ jobs: - name: Install dependencies run: python -m pip install --upgrade codecov tox - - name: Install tox-py - if: ${{ matrix.python-version == '3.6' }} - run: python -m pip install --upgrade tox-py - - name: Run tox targets for ${{ matrix.python-version }} - if: ${{ matrix.python-version != '3.6' }} run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d .) - - name: Run tox targets for ${{ matrix.python-version }} - if: ${{ matrix.python-version == '3.6' }} - run: tox --py current - - name: Run extra tox targets if: ${{ matrix.python-version == '3.9' }} run: | diff --git a/pyproject.toml b/pyproject.toml index 640ce32711..3621c240ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ classifiers = [ "Programming Language :: Python :: 3 :: Only", "Topic :: Internet :: WWW/HTTP", ] -requires-python = ">=3.6" +requires-python = ">=3.7" dependencies = [ "django>=3.0", 'backports.zoneinfo;python_version<"3.9"', From a71ed6aa64eff0a9ec089c99b5277576f7b2ff55 Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Fri, 6 Oct 2023 11:41:44 +0200 Subject: [PATCH 06/24] get package version from rest_framework.__version__ --- pyproject.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3621c240ba..82a8610553 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,6 @@ build-backend = "setuptools.build_meta" [project] name = "djangorestframework" -version = "3.14.0" authors = [{name = "Tom Christie", email = "tom@tomchristie.com"}] license = {text = "BSD"} description = "Web APIs for Django, made easy." @@ -38,6 +37,10 @@ dependencies = [ "django>=3.0", 'backports.zoneinfo;python_version<"3.9"', ] +dynamic = ["version"] + +[tool.setuptools.dynamic] +version = {attr = "rest_framework.__version__"} [project.readme] file = "README.md" From 0bcd15216ef151fb098e1b8e34e6e4f80880f5d4 Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Fri, 6 Oct 2023 11:43:37 +0200 Subject: [PATCH 07/24] more concise readme inclusion --- pyproject.toml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 82a8610553..2167f2a7df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "djangorestframework" +readme = "README.md" authors = [{name = "Tom Christie", email = "tom@tomchristie.com"}] license = {text = "BSD"} description = "Web APIs for Django, made easy." @@ -42,10 +43,6 @@ dynamic = ["version"] [tool.setuptools.dynamic] version = {attr = "rest_framework.__version__"} -[project.readme] -file = "README.md" -content-type = "text/markdown" - [project.urls] Homepage = "https://www.django-rest-framework.org/" Funding = "https://fund.django-rest-framework.org/topics/funding/" From 34840fd28ddeeb6b542eb5612a7ba0926a1fce0a Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Sat, 7 Oct 2023 13:59:55 +0200 Subject: [PATCH 08/24] remove flake8 config from pyproject.toml it was automatically migrated but flake8 doesn't support the pyproject.toml format --- pyproject.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2167f2a7df..19832789fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,10 +63,6 @@ addopts = "--tb=short --strict-markers -ra" testspath = "tests" filterwarnings = ["ignore:CoreAPI compatibility is deprecated*:rest_framework.RemovedInDRF317Warning"] -[tool.flake8] -ignore = "E501,W503,W504" -banned-modules = "json = use from rest_framework.utils import json!" - [tool.isort] skip = [".tox"] atomic = true From 9b6e714435a7464783b1d810805a2cbbeb0f7bbb Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Sat, 7 Oct 2023 14:02:39 +0200 Subject: [PATCH 09/24] remove 'zip-safe' and 'exclude' arguments zip-safe is deprecated and doesn't do anything. exclude 'tests*' is already the default behaviour --- pyproject.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 19832789fe..91dc092986 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,12 +50,10 @@ Source = "https://github.com/encode/django-rest-framework" Changelog = "https://www.django-rest-framework.org/community/release-notes/" [tool.setuptools] -zip-safe = false include-package-data = true license-files = ["LICENSE.md"] [tool.setuptools.packages.find] -exclude = ["tests*"] namespaces = false [tool.pytest.ini_options] From cf25dcdcd87573a6c67bc2ea1c91d592efa6f8ef Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Sat, 7 Oct 2023 14:04:33 +0200 Subject: [PATCH 10/24] move back non-packing related config into setup.cfg --- pyproject.toml | 26 -------------------------- setup.cfg | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 91dc092986..b4c0c232e0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,29 +55,3 @@ license-files = ["LICENSE.md"] [tool.setuptools.packages.find] namespaces = false - -[tool.pytest.ini_options] -addopts = "--tb=short --strict-markers -ra" -testspath = "tests" -filterwarnings = ["ignore:CoreAPI compatibility is deprecated*:rest_framework.RemovedInDRF317Warning"] - -[tool.isort] -skip = [".tox"] -atomic = true -multi_line_output = 5 -extra_standard_library = ["types"] -known_third_party = ["pytest", "_pytest", "django", "pytz", "uritemplate"] -known_first_party = ["rest_framework", "tests"] - -[tool.coverage.run] -# NOTE: source is ignored with pytest-cov (but uses the same). -source = ["."] -include = ["rest_framework/*", "tests/*"] -branch = true - -[tool.coverage.report] -include = ["rest_framework/*", "tests/*"] -exclude_lines = [ - "pragma: no cover", - "raise NotImplementedError", -] diff --git a/setup.cfg b/setup.cfg index aebdf53629..874b27acda 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,28 @@ +[tool:pytest] +addopts=--tb=short --strict-markers -ra +testspath = tests +filterwarnings = ignore:CoreAPI compatibility is deprecated*:rest_framework.RemovedInDRF317Warning + [flake8] ignore = E501,W503,W504 banned-modules = json = use from rest_framework.utils import json! + +[isort] +skip=.tox +atomic=true +multi_line_output=5 +extra_standard_library=types +known_third_party=pytest,_pytest,django,pytz,uritemplate +known_first_party=rest_framework,tests + +[coverage:run] +# NOTE: source is ignored with pytest-cov (but uses the same). +source = . +include = rest_framework/*,tests/* +branch = 1 + +[coverage:report] +include = rest_framework/*,tests/* +exclude_lines = + pragma: no cover + raise NotImplementedError From 040ded0f567ae49dcc19d74d717582d815ddd37b Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Tue, 27 Feb 2024 14:40:28 +0100 Subject: [PATCH 11/24] remove unneeded include-package-data field --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b4c0c232e0..8b618d1e46 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,6 @@ Source = "https://github.com/encode/django-rest-framework" Changelog = "https://www.django-rest-framework.org/community/release-notes/" [tool.setuptools] -include-package-data = true license-files = ["LICENSE.md"] [tool.setuptools.packages.find] From 9ce6b6254fc0247892fa10ff24ddc808d9bfc80e Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Tue, 27 Feb 2024 14:42:26 +0100 Subject: [PATCH 12/24] remove 'license-files' field --- pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8b618d1e46..9dc68bfbbc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,8 +49,5 @@ Funding = "https://fund.django-rest-framework.org/topics/funding/" Source = "https://github.com/encode/django-rest-framework" Changelog = "https://www.django-rest-framework.org/community/release-notes/" -[tool.setuptools] -license-files = ["LICENSE.md"] - [tool.setuptools.packages.find] namespaces = false From c4bcfc45b812e6aa60430f0e7f3d55be0cc90aff Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Wed, 28 Feb 2024 09:48:20 +0100 Subject: [PATCH 13/24] Revert "remove python 3.6" This reverts commit c2062da2441e8c6e4e4a4e6e5d90c9ca610c7987. --- .github/workflows/main.yml | 10 ++++++++++ pyproject.toml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e2ee00978d..756b6d24ba 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,6 +14,7 @@ jobs: strategy: matrix: python-version: + - '3.6' - '3.7' - '3.8' - '3.9' @@ -36,9 +37,18 @@ jobs: - name: Install dependencies run: python -m pip install --upgrade codecov tox + - name: Install tox-py + if: ${{ matrix.python-version == '3.6' }} + run: python -m pip install --upgrade tox-py + - name: Run tox targets for ${{ matrix.python-version }} + if: ${{ matrix.python-version != '3.6' }} run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d .) + - name: Run tox targets for ${{ matrix.python-version }} + if: ${{ matrix.python-version == '3.6' }} + run: tox --py current + - name: Run extra tox targets if: ${{ matrix.python-version == '3.9' }} run: | diff --git a/pyproject.toml b/pyproject.toml index 9dc68bfbbc..538867dce6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ classifiers = [ "Programming Language :: Python :: 3 :: Only", "Topic :: Internet :: WWW/HTTP", ] -requires-python = ">=3.7" +requires-python = ">=3.6" dependencies = [ "django>=3.0", 'backports.zoneinfo;python_version<"3.9"', From 2ef61269ab146dd2c207eef8000b0d6a131225a4 Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Wed, 16 Oct 2024 13:51:27 +0200 Subject: [PATCH 14/24] pre-commit: tomli optional additional dependency Issue: # --- .pre-commit-config.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8939dd3db6..f685bddd60 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,3 +31,6 @@ repos: hooks: - id: codespell exclude: locale|kickstarter-announcement.md|coreapi-0.1.1.js + additional_dependencies: + # python doesn't come with a toml parser prior to 3.11 + - "tomli; python_version < '3.11'" From c8030fc55f77c1788cff6021a370ee2d4ff11c97 Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Wed, 16 Oct 2024 13:54:45 +0200 Subject: [PATCH 15/24] remove final wording note from pyproject.toml --- pyproject.toml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6b12bd41fe..164bb39247 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,9 +87,3 @@ exclude_lines = [ # Ref: https://github.com/codespell-project/codespell#using-a-config-file skip = "*/kickstarter-announcement.md,*.js,*.map,*.po" ignore-words-list = "fo,malcom,ser" - -# (*) Please direct queries to the discussion group, rather than to me directly -# Doing so helps ensure your question is helpful to other users. -# Queries directly to my email are likely to receive a canned response. -# -# Many thanks for your understanding. From 0101d893f45c948bc580e672cc3ddf000e08746e Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Wed, 16 Oct 2024 14:06:59 +0200 Subject: [PATCH 16/24] remove flake8 section in pyproject --- pyproject.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 164bb39247..cdd0a1075f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,10 +58,6 @@ addopts = "--tb=short --strict-markers -ra" testpaths = ["tests"] filterwarnings = ["ignore:CoreAPI compatibility is deprecated*:rest_framework.RemovedInDRF317Warning"] -[tool.flake8] -ignore = "E501,W503,W504" -banned-modules = "json = use from rest_framework.utils import json!" - [tool.isort] skip = [".tox"] atomic = true From c1c39d4182bfbc18c274f82309ef92b2407e7f2b Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Wed, 16 Oct 2024 14:53:33 +0200 Subject: [PATCH 17/24] delete setup.py --- setup.py | 120 ------------------------------------------------------- 1 file changed, 120 deletions(-) delete mode 100755 setup.py diff --git a/setup.py b/setup.py deleted file mode 100755 index 67904ec61f..0000000000 --- a/setup.py +++ /dev/null @@ -1,120 +0,0 @@ -import os -import re -import shutil -import sys -from io import open - -from setuptools import find_packages, setup - -CURRENT_PYTHON = sys.version_info[:2] -REQUIRED_PYTHON = (3, 8) - -# This check and everything above must remain compatible with Python 2.7. -if CURRENT_PYTHON < REQUIRED_PYTHON: - sys.stderr.write(""" -========================== -Unsupported Python version -========================== - -This version of Django REST Framework requires Python {}.{}, but you're trying -to install it on Python {}.{}. - -This may be because you are using a version of pip that doesn't -understand the python_requires classifier. Make sure you -have pip >= 9.0 and setuptools >= 24.2, then try again: - - $ python -m pip install --upgrade pip setuptools - $ python -m pip install djangorestframework - -This will install the latest version of Django REST Framework which works on -your version of Python. If you can't upgrade your pip (or Python), request -an older version of Django REST Framework: - - $ python -m pip install "djangorestframework<3.10" -""".format(*(REQUIRED_PYTHON + CURRENT_PYTHON))) - sys.exit(1) - - -def read(f): - with open(f, 'r', encoding='utf-8') as file: - return file.read() - - -def get_version(package): - """ - Return package version as listed in `__version__` in `init.py`. - """ - init_py = open(os.path.join(package, '__init__.py')).read() - return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1) - - -version = get_version('rest_framework') - - -if sys.argv[-1] == 'publish': - if os.system("pip freeze | grep twine"): - print("twine not installed.\nUse `pip install twine`.\nExiting.") - sys.exit() - os.system("python setup.py sdist bdist_wheel") - if os.system("twine check dist/*"): - print("twine check failed. Packages might be outdated.") - print("Try using `pip install -U twine wheel`.\nExiting.") - sys.exit() - os.system("twine upload dist/*") - print("You probably want to also tag the version now:") - print(" git tag -a %s -m 'version %s'" % (version, version)) - print(" git push --tags") - shutil.rmtree('dist') - shutil.rmtree('build') - shutil.rmtree('djangorestframework.egg-info') - sys.exit() - - -setup( - name='djangorestframework', - version=version, - url='https://www.django-rest-framework.org/', - license='BSD', - description='Web APIs for Django, made easy.', - long_description=read('README.md'), - long_description_content_type='text/markdown', - author='Tom Christie', - author_email='tom@tomchristie.com', # SEE NOTE BELOW (*) - packages=find_packages(exclude=['tests*']), - include_package_data=True, - install_requires=["django>=4.2", 'backports.zoneinfo;python_version<"3.9"'], - python_requires=">=3.8", - zip_safe=False, - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Web Environment', - 'Framework :: Django', - 'Framework :: Django :: 4.2', - 'Framework :: Django :: 5.0', - 'Framework :: Django :: 5.1', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - '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', - 'Programming Language :: Python :: 3 :: Only', - 'Topic :: Internet :: WWW/HTTP', - ], - project_urls={ - 'Funding': 'https://fund.django-rest-framework.org/topics/funding/', - 'Source': 'https://github.com/encode/django-rest-framework', - 'Changelog': 'https://www.django-rest-framework.org/community/release-notes/', - }, -) - -# (*) Please direct queries to the discussion group, rather than to me directly -# Doing so helps ensure your question is helpful to other users. -# Queries directly to my email are likely to receive a canned response. -# -# Many thanks for your understanding. From 561bd4ccd98f7a19b40ddbfdd75fb0c82d82d4bc Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Thu, 17 Oct 2024 10:47:58 +0200 Subject: [PATCH 18/24] ci: remove tox 'isolated_build' --- tox.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/tox.ini b/tox.ini index 291a1e2fb0..f565a12819 100644 --- a/tox.ini +++ b/tox.ini @@ -8,7 +8,6 @@ envlist = base dist docs -isolated_build = true [testenv] commands = python -W error::DeprecationWarning -W error::PendingDeprecationWarning runtests.py --coverage {posargs} From 29205f0fcae3b68fe39bad5c41422b0bf45200b2 Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Fri, 18 Oct 2024 14:23:42 +0200 Subject: [PATCH 19/24] restore minimalist setup.py --- setup.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 setup.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000000..606849326a --- /dev/null +++ b/setup.py @@ -0,0 +1,3 @@ +from setuptools import setup + +setup() From 12789684c080f4d7a467e99c52e2dd016fccd5f6 Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Fri, 15 Nov 2024 15:35:31 +0100 Subject: [PATCH 20/24] also update build/upload instruction --- docs/community/project-management.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/community/project-management.md b/docs/community/project-management.md index 4f203e13bb..87f9667868 100644 --- a/docs/community/project-management.md +++ b/docs/community/project-management.md @@ -60,8 +60,8 @@ The following template should be used for the description of the issue, and serv - [ ] Create pull request for [release notes](https://github.com/encode/django-rest-framework/blob/master/docs/topics/release-notes.md) based on the [*.*.* milestone](https://github.com/encode/django-rest-framework/milestones/***). - [ ] Update supported versions: - - [ ] `setup.py` `python_requires` list - - [ ] `setup.py` Python & Django version trove classifiers + - [ ] `pyproject.toml` `python_requires` list + - [ ] `pyproject.toml` Python & Django version trove classifiers - [ ] `README` Python & Django versions - [ ] `docs` Python & Django versions - [ ] Update the translations from [transifex](https://www.django-rest-framework.org/topics/project-management/#translations). @@ -72,7 +72,9 @@ The following template should be used for the description of the issue, and serv - [ ] Confirm with @tomchristie that release is finalized and ready to go. - [ ] Ensure that release date is included in pull request. - [ ] Merge the release pull request. - - [ ] Push the package to PyPI with `./setup.py publish`. + - [ ] Install the release tools: `pip install build twine` + - [ ] Build the package: `python -m build` + - [ ] Push the package to PyPI with `twine upload dist/*` - [ ] Tag the release, with `git tag -a *.*.* -m 'version *.*.*'; git push --tags`. - [ ] Deploy the documentation with `mkdocs gh-deploy`. - [ ] Make a release announcement on the [discussion group](https://groups.google.com/forum/?fromgroups#!forum/django-rest-framework). From 06bebc216d59253eaebcf04532f2bf910cc35364 Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Sun, 1 Dec 2024 15:44:47 +0100 Subject: [PATCH 21/24] remove parameters for which the value is already the default thanks to @terencehonles Co-authored-by: Terence Honles --- pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index cdd0a1075f..df88686734 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,9 +46,6 @@ Source = "https://github.com/encode/django-rest-framework" Changelog = "https://www.django-rest-framework.org/community/release-notes/" [tool.setuptools] -zip-safe = false -include-package-data = true -license-files = ["LICENSE.md"] [tool.setuptools.packages.find] namespaces = false From ea10c54025ad1bdd2e19f1e2fd57ca773bc0530b Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Sun, 1 Dec 2024 15:45:47 +0100 Subject: [PATCH 22/24] use 'rest_framework' package namespace Co-authored-by: Terence Honles --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index df88686734..a75aa6a057 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,8 +47,7 @@ Changelog = "https://www.django-rest-framework.org/community/release-notes/" [tool.setuptools] -[tool.setuptools.packages.find] -namespaces = false +packages = ["rest_framework"] [tool.pytest.ini_options] addopts = "--tb=short --strict-markers -ra" From 5729b02c691cc044c57baf95531fd7afdb79a786 Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Sun, 1 Dec 2024 23:29:37 +0100 Subject: [PATCH 23/24] Revert "use 'rest_framework' package namespace" This reverts commit ea10c54025ad1bdd2e19f1e2fd57ca773bc0530b. --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a75aa6a057..df88686734 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,8 @@ Changelog = "https://www.django-rest-framework.org/community/release-notes/" [tool.setuptools] -packages = ["rest_framework"] +[tool.setuptools.packages.find] +namespaces = false [tool.pytest.ini_options] addopts = "--tb=short --strict-markers -ra" From 7770fe4b331e71198479dd81588dfae4fea49406 Mon Sep 17 00:00:00 2001 From: Mathieu Dupuy Date: Mon, 2 Dec 2024 23:46:51 +0100 Subject: [PATCH 24/24] include "rest_framework*" in pyproject.toml Co-authored-by: Terence Honles --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index df88686734..5c49384b26 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,7 @@ Changelog = "https://www.django-rest-framework.org/community/release-notes/" [tool.setuptools] [tool.setuptools.packages.find] -namespaces = false +include = ["rest_framework*"] [tool.pytest.ini_options] addopts = "--tb=short --strict-markers -ra"