From 38bda60f5205045283bc70b3a0bc5765ad51d7a0 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 8 Nov 2024 20:44:03 +0100 Subject: [PATCH 01/10] PEP 621: Migrate from setup.py to pyproject.toml --- pyproject.toml | 58 +++++++++++++++++++++++++++++++++++++++++ setup.cfg | 10 ------- setup.py | 71 -------------------------------------------------- tox.ini | 23 ++++++++++------ 4 files changed, 73 insertions(+), 89 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..56840e5 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,58 @@ +[build-system] +build-backend = "setuptools.build_meta" + +requires = [ + "setuptools>=61.2", + "setuptools-scm", +] + +[project] +name = "django-configurations" +description = "A helper for organizing Django settings." +readme.content-type = "text/x-rst" +readme.file = "README.rst" +license = { text = "BSD" } +authors = [ { name = "Jannis Leidel", email = "jannis@leidel.info" } ] +requires-python = ">=3.9,<4.0" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Framework :: Django", + "Framework :: Django :: 3.2", + "Framework :: Django :: 4.1", + "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 :: Only", + "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 :: Implementation :: PyPy", + "Topic :: Utilities", +] +dynamic = [ "version" ] + +dependencies = [ "django>=3.2" ] +optional-dependencies.cache = [ "django-cache-url" ] +optional-dependencies.database = [ "dj-database-url" ] +optional-dependencies.email = [ "dj-email-url" ] +optional-dependencies.search = [ "dj-search-url" ] +optional-dependencies.testing = [ + "dj-database-url", + "dj-email-url", + "dj-search-url", + "django-cache-url>=1", +] +urls.Homepage = "https://django-configurations.readthedocs.io/" +urls.Source = "https://github.com/jazzband/django-configurations" +scripts.django-cadmin = "configurations.management:execute_from_command_line" + +[tool.setuptools] +packages = [ "configurations" ] +zip-safe = false +include-package-data = false diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 4c03348..0000000 --- a/setup.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[coverage:run] -source = . -branch = 1 -parallel = 1 -[coverage:report] -include = configurations/*,tests/* - -[flake8] -exclude = .tox,docs/*,.eggs -ignore = E501,E127,E128,E124,W503 diff --git a/setup.py b/setup.py deleted file mode 100644 index fa61273..0000000 --- a/setup.py +++ /dev/null @@ -1,71 +0,0 @@ -import os -import codecs -from setuptools import setup - - -def read(*parts): - filename = os.path.join(os.path.dirname(__file__), *parts) - with codecs.open(filename, encoding='utf-8') as fp: - return fp.read() - - -setup( - name="django-configurations", - use_scm_version={"version_scheme": "post-release", "local_scheme": "dirty-tag"}, - setup_requires=["setuptools_scm"], - url='https://django-configurations.readthedocs.io/', - project_urls={ - 'Source': 'https://github.com/jazzband/django-configurations', - }, - license='BSD', - description="A helper for organizing Django settings.", - long_description=read('README.rst'), - long_description_content_type='text/x-rst', - author='Jannis Leidel', - author_email='jannis@leidel.info', - packages=['configurations'], - entry_points={ - 'console_scripts': [ - 'django-cadmin = configurations.management:execute_from_command_line', - ], - }, - install_requires=[ - 'django>=3.2', - ], - python_requires='>=3.9, <4.0', - extras_require={ - 'cache': ['django-cache-url'], - 'database': ['dj-database-url'], - 'email': ['dj-email-url'], - 'search': ['dj-search-url'], - 'testing': [ - 'django-cache-url>=1.0.0', - 'dj-database-url', - 'dj-email-url', - 'dj-search-url', - ], - }, - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Framework :: Django', - 'Framework :: Django :: 3.2', - 'Framework :: Django :: 4.1', - '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 :: Only', - '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 :: Implementation :: PyPy', - 'Topic :: Utilities', - ], - zip_safe=False, -) diff --git a/tox.ini b/tox.ini index 9dc5e45..79eb878 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,7 @@ [tox] skipsdist = true +skip_missing_interpreters = true +isolated_build = true usedevelop = true minversion = 1.8 envlist = @@ -25,7 +27,7 @@ usedevelop = true setenv = DJANGO_SETTINGS_MODULE = tests.settings.main DJANGO_CONFIGURATION = Test - COVERAGE_PROCESS_START = {toxinidir}/setup.cfg + COVERAGE_PROCESS_START = {toxinidir}/pyproject.toml deps = dj32: django~=3.2.9 dj41: django~=4.1.3 @@ -44,16 +46,17 @@ commands = python --version {envbindir}/coverage run {envbindir}/django-cadmin test -v2 {posargs:tests} coverage combine . tests docs - coverage report -m --skip-covered + coverage report --show-missing --skip-covered coverage xml [testenv:py311-checkqa] commands = flake8 {toxinidir} - check-manifest -v - python setup.py sdist + check-manifest --verbose + python -m build twine check dist/* deps = + build flake8 twine check-manifest @@ -64,9 +67,13 @@ deps = -r docs/requirements.txt commands = sphinx-build \ - -b html \ - -a \ - -W \ - -n \ + --builder html \ + --write-all \ + --fail-on-warning \ + --nitpicky \ docs \ docs/_build/html + +[flake8] +exclude = .tox,docs/*,.eggs +ignore = E124,E127,E128,E501,W503 From 3a9e25177e028e129888e455b34224e0b7754c7d Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 8 Nov 2024 21:17:08 +0100 Subject: [PATCH 02/10] python -m pip install --editable ".[test]" --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 314cdb4..db06ec9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,7 +29,7 @@ jobs: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT - name: Cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.pip-cache.outputs.dir }} key: @@ -41,6 +41,7 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install --upgrade "tox<4" "tox-gh-actions<3" + python -m pip install --editable ".[test]" - name: Tox tests run: | From e3bbe63fe615a090065ce2ff65253223a1c0c285 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 8 Nov 2024 21:22:20 +0100 Subject: [PATCH 03/10] pipx run tox-ini-fmt tox.ini --- .github/workflows/test.yml | 4 +- tox.ini | 81 +++++++++++++++++++------------------- 2 files changed, 43 insertions(+), 42 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index db06ec9..819e49a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,8 +40,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install --upgrade "tox<4" "tox-gh-actions<3" - python -m pip install --editable ".[test]" + python -m pip install --upgrade tox tox-gh-actions + python -m pip install --editable ".[testing]" - name: Tox tests run: | diff --git a/tox.ini b/tox.ini index 79eb878..dec50c0 100644 --- a/tox.ini +++ b/tox.ini @@ -1,34 +1,23 @@ [tox] -skipsdist = true -skip_missing_interpreters = true -isolated_build = true -usedevelop = true -minversion = 1.8 -envlist = +requires = + tox>=4.2 +env_list = py311-checkqa docs - py{39}-dj{32,41,42} - py{310,py310}-dj{32,41,42,50,main} - py{311}-dj{41,42,50,51,main} - py{312}-dj{50,51,main} - py{313}-dj{50,51,main} - -[gh-actions] -python = - 3.9: py39 - 3.10: py310 - 3.11: py311,flake8,readme - 3.12: py312 - 3.13: py313 - pypy-3.10: pypy310 + py{39}-dj{42, 41, 32} + py{py310, 310}-dj{50, 42, 41, 32, main} + py{311}-dj{51, 50, 42, 41, main} + py{312}-dj{51, 50, main} + py{313}-dj{51, 50, main} +no_package = true +skip_missing_interpreters = true +usedevelop = true [testenv] -usedevelop = true -setenv = - DJANGO_SETTINGS_MODULE = tests.settings.main - DJANGO_CONFIGURATION = Test - COVERAGE_PROCESS_START = {toxinidir}/pyproject.toml +package = editable deps = + coverage + coverage_enable_subprocess dj32: django~=3.2.9 dj41: django~=4.1.3 dj42: django~=4.2.0 @@ -39,9 +28,12 @@ deps = py312: wheel py313: setuptools py313: wheel - coverage - coverage_enable_subprocess -extras = testing +extras = + testing +set_env = + COVERAGE_PROCESS_START = {toxinidir}/pyproject.toml + DJANGO_CONFIGURATION = Test + DJANGO_SETTINGS_MODULE = tests.settings.main commands = python --version {envbindir}/coverage run {envbindir}/django-cadmin test -v2 {posargs:tests} @@ -50,29 +42,38 @@ commands = coverage xml [testenv:py311-checkqa] +deps = + build + check-manifest + flake8 + twine commands = flake8 {toxinidir} check-manifest --verbose python -m build twine check dist/* -deps = - build - flake8 - twine - check-manifest [testenv:docs] -setenv = deps = -r docs/requirements.txt +set_env = commands = sphinx-build \ - --builder html \ - --write-all \ - --fail-on-warning \ - --nitpicky \ - docs \ - docs/_build/html + --builder html \ + --write-all \ + --fail-on-warning \ + --nitpicky \ + docs \ + docs/_build/html + +[gh-actions] +python = + 3.9: py39 + 3.10: py310 + 3.11: py311,flake8,readme + 3.12: py312 + 3.13: py313 + pypy-3.10: pypy310 [flake8] exclude = .tox,docs/*,.eggs From 0cdbbc7b66848b7774523a225362f86172bb59e3 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 8 Nov 2024 21:28:04 +0100 Subject: [PATCH 04/10] python -m pip install --upgrade tomli --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 819e49a..bf3e686 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,7 +40,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install --upgrade tox tox-gh-actions + python -m pip install --upgrade tomli tox tox-gh-actions python -m pip install --editable ".[testing]" - name: Tox tests From 027838439608fa3795df714d7ce0a861c26348b4 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 8 Nov 2024 21:35:00 +0100 Subject: [PATCH 05/10] python -m pip install coverage[toml] --- .github/workflows/test.yml | 2 +- tox.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bf3e686..819e49a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,7 +40,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install --upgrade tomli tox tox-gh-actions + python -m pip install --upgrade tox tox-gh-actions python -m pip install --editable ".[testing]" - name: Tox tests diff --git a/tox.ini b/tox.ini index dec50c0..526d8f4 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,7 @@ usedevelop = true [testenv] package = editable deps = - coverage + coverage[toml] coverage_enable_subprocess dj32: django~=3.2.9 dj41: django~=4.1.3 From d3c3f7146ff1ef68d9f297be878ee8a7b9205a58 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 9 Nov 2024 03:14:43 +0100 Subject: [PATCH 06/10] env: DJANGO_CONFIGURATION and DJANGO_SETTINGS_MODULE --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 819e49a..6fda89d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,6 +44,9 @@ jobs: python -m pip install --editable ".[testing]" - name: Tox tests + env: + DJANGO_CONFIGURATION: Dev + DJANGO_SETTINGS_MODULE: mysite.settings run: | tox --verbose From ccafa006756ff8c6597661c41f06a55b65b3e233 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 9 Nov 2024 03:23:14 +0100 Subject: [PATCH 07/10] which django-cadmin --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 526d8f4..2241073 100644 --- a/tox.ini +++ b/tox.ini @@ -36,7 +36,7 @@ set_env = DJANGO_SETTINGS_MODULE = tests.settings.main commands = python --version - {envbindir}/coverage run {envbindir}/django-cadmin test -v2 {posargs:tests} + {envbindir}/coverage run django-cadmin test -v2 {posargs:tests} coverage combine . tests docs coverage report --show-missing --skip-covered coverage xml From 8e70aa2ea2c21f78edda534ca1ec643ba20dd9d2 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 9 Nov 2024 03:33:04 +0100 Subject: [PATCH 08/10] which django-cadmin --- tox.ini | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tox.ini b/tox.ini index 2241073..d58f9ae 100644 --- a/tox.ini +++ b/tox.ini @@ -34,8 +34,14 @@ set_env = COVERAGE_PROCESS_START = {toxinidir}/pyproject.toml DJANGO_CONFIGURATION = Test DJANGO_SETTINGS_MODULE = tests.settings.main +allowlist_externals = + django-cadmin + echo + which commands = python --version + echo {toxinidir} {envbindir} + which django-cadmin {envbindir}/coverage run django-cadmin test -v2 {posargs:tests} coverage combine . tests docs coverage report --show-missing --skip-covered From 689f60f41388fa2e43aef93943aa3f787b209e34 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 9 Nov 2024 03:37:55 +0100 Subject: [PATCH 09/10] which django-cadmin --- .github/workflows/test.yml | 4 ++-- tox.ini | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6fda89d..36a58d2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,8 +45,8 @@ jobs: - name: Tox tests env: - DJANGO_CONFIGURATION: Dev - DJANGO_SETTINGS_MODULE: mysite.settings + DJANGO_CONFIGURATION: Test + DJANGO_SETTINGS_MODULE: tests.settings.main run: | tox --verbose diff --git a/tox.ini b/tox.ini index d58f9ae..79496bf 100644 --- a/tox.ini +++ b/tox.ini @@ -42,7 +42,7 @@ commands = python --version echo {toxinidir} {envbindir} which django-cadmin - {envbindir}/coverage run django-cadmin test -v2 {posargs:tests} + {envbindir}/coverage run $(which django-cadmin) test -v2 {posargs:tests} coverage combine . tests docs coverage report --show-missing --skip-covered coverage xml From d2cc4066a1d6427ec9cc08fbdbdc0c1b72181b9c Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 9 Nov 2024 03:41:44 +0100 Subject: [PATCH 10/10] which django-cadmin --- tox.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 79496bf..bf4d82f 100644 --- a/tox.ini +++ b/tox.ini @@ -34,6 +34,7 @@ set_env = COVERAGE_PROCESS_START = {toxinidir}/pyproject.toml DJANGO_CONFIGURATION = Test DJANGO_SETTINGS_MODULE = tests.settings.main + DJANGO_CADMIN = $(which django-cadmin) allowlist_externals = django-cadmin echo @@ -42,7 +43,7 @@ commands = python --version echo {toxinidir} {envbindir} which django-cadmin - {envbindir}/coverage run $(which django-cadmin) test -v2 {posargs:tests} + {envbindir}/coverage run DJANGO_CADMIN test -v2 {posargs:tests} coverage combine . tests docs coverage report --show-missing --skip-covered coverage xml