From 87b1b1071b97fba5568c20cb6a48a8c7b7fc2ba2 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Tue, 12 Dec 2023 20:09:44 +0000 Subject: [PATCH 01/13] Add official support for Django 5.0 and Python 3.12 --- .github/workflows/build.yaml | 1 + README.md | 4 ++-- setup.py | 2 ++ tox.ini | 6 +++++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index cd33444..fe1d91b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,6 +15,7 @@ jobs: - python-version: 3.9 - python-version: "3.10" - python-version: "3.11" + - python-version: "3.12" env: PYTHON: ${{ matrix.python-version }} diff --git a/README.md b/README.md index 1cf4d0c..4bf0faf 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ The following relations are supported: Requirements ============ -- Python (3.7, 3.8, 3.9, 3.10, 3.11) -- Django (2.2, 3.0, 3.1, 3.2, 4.0, 4.1, 4.2) +- Python (3.7, 3.8, 3.9, 3.10, 3.11, 3.12) +- Django (2.2, 3.0, 3.1, 3.2, 4.0, 4.1, 4.2, 5.0) - djangorestframework (3.8+) Installation diff --git a/setup.py b/setup.py index dab572f..f1dfec6 100644 --- a/setup.py +++ b/setup.py @@ -51,6 +51,7 @@ def get_version(package): 'Framework :: Django :: 4.0', 'Framework :: Django :: 4.1', 'Framework :: Django :: 4.2', + 'Framework :: Django :: 5.0', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', @@ -62,6 +63,7 @@ def get_version(package): 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Topic :: Internet :: WWW/HTTP', ] ) diff --git a/tox.ini b/tox.ini index e086426..74b2115 100644 --- a/tox.ini +++ b/tox.ini @@ -8,7 +8,8 @@ envlist = py{37,38}-dj{30}-drf{310,311}-{pytest,mypy} py{37,38,39,310,311}-dj{31,32}-drf{311,312,313,314}-{pytest,mypy} py{38,39,310,311}-dj{40,41}-drf{313,314}-{pytest,mypy} - py{38,39,310,311}-dj{42}-drf{314}-{pytest,mypy} + py{38,39,310,311,312}-dj{42}-drf{314}-{pytest,mypy} + py{310,311,312}-dj{50}-drf{314}-{pytest,mypy} skip_missing_interpreters = true [gh-actions] @@ -18,6 +19,7 @@ python = 3.9: py39 3.10: py310 3.11: py311 + 3.12: py312 django = 2.2: dj22 3.0: dj30 @@ -26,6 +28,7 @@ django = 4.0: dj40 4.1: dj41 4.2: dj42 + 5.0: dj50 [testenv] setenv = @@ -39,6 +42,7 @@ deps = dj40: Django>=4.0,<4.1 dj41: Django>=4.1,<4.2 dj42: Django>=4.2,<5.0 + dj50: Django>=5.0,<5.1 drf38: djangorestframework>=3.8.0,<3.9 drf39: djangorestframework>=3.9.0,<3.10 drf310: djangorestframework>=3.10.0,<3.11 From 9adf635db87eec7d3be395bf7a03f99c1fa90498 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Tue, 12 Dec 2023 20:12:14 +0000 Subject: [PATCH 02/13] Comment out Python 3.12 for now --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fe1d91b..55904fe 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,7 +15,7 @@ jobs: - python-version: 3.9 - python-version: "3.10" - python-version: "3.11" - - python-version: "3.12" + # - python-version: "3.12" env: PYTHON: ${{ matrix.python-version }} From 9a1c60fd98dcf969df620e0ddac81bf48a69d979 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Wed, 13 Dec 2023 09:26:19 +0000 Subject: [PATCH 03/13] Make a note in toxfile --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index e086426..cee1679 100644 --- a/tox.ini +++ b/tox.ini @@ -47,6 +47,7 @@ deps = drf313: djangorestframework>=3.13,<3.14 drf314: djangorestframework>=3.14,<3.15 pytest: -rrequirements.txt + # Fix theses mypy: git+https://github.com/typeddjango/djangorestframework-stubs.git@946c7d60aaecdc9ef307f5e1f8eb55f7083ffb16#egg=djangorestframework-stubs mypy: djangorestframework-stubs commands= From 22b4214e9d51c6d8aa6547121b70738a57f37669 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Wed, 13 Dec 2023 09:36:43 +0000 Subject: [PATCH 04/13] Install latest version of djangorestframework-stubs, with correct version of mypy --- tox.ini | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index cee1679..4753448 100644 --- a/tox.ini +++ b/tox.ini @@ -47,9 +47,7 @@ deps = drf313: djangorestframework>=3.13,<3.14 drf314: djangorestframework>=3.14,<3.15 pytest: -rrequirements.txt - # Fix theses - mypy: git+https://github.com/typeddjango/djangorestframework-stubs.git@946c7d60aaecdc9ef307f5e1f8eb55f7083ffb16#egg=djangorestframework-stubs - mypy: djangorestframework-stubs + mypy: djangorestframework-stubs[compatible-mypy] commands= pytest: pytest --cov drf_writable_nested --cov-report=xml mypy: mypy example From a88cecf86353219bd30cfeab7fe1ef55d9c270b2 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Wed, 13 Dec 2023 09:37:22 +0000 Subject: [PATCH 05/13] Finish running the whole CI matrix before stopping --- .github/workflows/build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index cd33444..fbfac83 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -8,6 +8,7 @@ jobs: build: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: include: - python-version: 3.7 From dcdd232424f28a61b16a30b7f0e732d1b4c3a9ec Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Wed, 13 Dec 2023 09:46:25 +0000 Subject: [PATCH 06/13] Ignore type error from mypy error: "type[UFMChild]" has no attribute "objects" [attr-defined] It's a Django model, this attribute exists... --- tests/serializers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/serializers.py b/tests/serializers.py index 811e035..3c5e46f 100644 --- a/tests/serializers.py +++ b/tests/serializers.py @@ -202,9 +202,10 @@ class Meta: class UFMChildSerializerForValidatorMessage(UniqueFieldsMixin, serializers.ModelSerializer): field = serializers.CharField(validators=[ - UniqueValidator(queryset=models.UFMChild.objects.all(), - message=UNIQUE_ERROR_MESSAGE - ) + UniqueValidator( + queryset=models.UFMChild.objects.all(), # type: ignore[attr-defined] + message=UNIQUE_ERROR_MESSAGE, + ) ]) class Meta: From 22770e6927d10ee1a523d2c7f145a9bbd5b3ab78 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Wed, 13 Dec 2023 09:58:23 +0000 Subject: [PATCH 07/13] Add --show-traceback to mypy runs --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 4753448..49f8c79 100644 --- a/tox.ini +++ b/tox.ini @@ -50,5 +50,5 @@ deps = mypy: djangorestframework-stubs[compatible-mypy] commands= pytest: pytest --cov drf_writable_nested --cov-report=xml - mypy: mypy example - mypy: mypy . + mypy: mypy --show-traceback example + mypy: mypy --show-traceback . From f99bddadb75360c4a0279c2cd2ce62996600bdaa Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Wed, 13 Dec 2023 10:13:17 +0000 Subject: [PATCH 08/13] Don't run mypy on older versions of Django --- tox.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tox.ini b/tox.ini index 49f8c79..c542b12 100644 --- a/tox.ini +++ b/tox.ini @@ -4,10 +4,10 @@ DJANGO_SETTINGS_MODULE = tests.settings [tox] envlist = - py{37,38}-dj{22}-drf{38,39,310,311}-{pytest,mypy} - py{37,38}-dj{30}-drf{310,311}-{pytest,mypy} - py{37,38,39,310,311}-dj{31,32}-drf{311,312,313,314}-{pytest,mypy} - py{38,39,310,311}-dj{40,41}-drf{313,314}-{pytest,mypy} + py{37,38}-dj{22}-drf{38,39,310,311}-pytest + py{37,38}-dj{30}-drf{310,311}-pytest + py{37,38,39,310,311}-dj{31,32}-drf{311,312,313,314}-pytest + py{38,39,310,311}-dj{40,41}-drf{313,314}-pytest py{38,39,310,311}-dj{42}-drf{314}-{pytest,mypy} skip_missing_interpreters = true From e6b4d82cd335543556f014ed18940086b8b5d2f7 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Mon, 22 Jul 2024 09:01:10 +0200 Subject: [PATCH 09/13] Drop support for Django<3.2 and Python 3.7 --- .github/workflows/build.yaml | 1 - tox.ini | 14 +------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5d21ff0..d018879 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -11,7 +11,6 @@ jobs: fail-fast: false matrix: include: - - python-version: 3.7 - python-version: 3.8 - python-version: 3.9 - python-version: "3.10" diff --git a/tox.ini b/tox.ini index 4aa997c..f237c61 100644 --- a/tox.ini +++ b/tox.ini @@ -4,9 +4,7 @@ DJANGO_SETTINGS_MODULE = tests.settings [tox] envlist = - py{37,38}-dj{22}-drf{38,39,310,311}-pytest - py{37,38}-dj{30}-drf{310,311}-pytest - py{37,38,39,310,311}-dj{31,32}-drf{311,312,313,314}-pytest + py{38,39,310,311}-dj{32}-drf{311,312,313,314}-pytest py{38,39,310,311}-dj{40,41}-drf{313,314}-pytest py{38,39,310,311,312}-dj{42}-drf{314}-{pytest,mypy} py{310,311,312}-dj{50}-drf{314}-{pytest,mypy} @@ -14,16 +12,12 @@ skip_missing_interpreters = true [gh-actions] python = - 3.7: py37 3.8: py38 3.9: py39 3.10: py310 3.11: py311 3.12: py312 django = - 2.2: dj22 - 3.0: dj30 - 3.1: dj31 3.2: dj32 4.0: dj40 4.1: dj41 @@ -35,17 +29,11 @@ setenv = PYTHONDONTWRITEBYTECODE=1 PYTHONWARNINGS=once deps = - dj22: Django>=2.2,<2.3 - dj30: Django>=3.0,<3.1 - dj31: Django>=3.1,<3.2 dj32: Django>=3.2a1,<4.0 dj40: Django>=4.0,<4.1 dj41: Django>=4.1,<4.2 dj42: Django>=4.2,<5.0 dj50: Django>=5.0,<5.1 - drf38: djangorestframework>=3.8.0,<3.9 - drf39: djangorestframework>=3.9.0,<3.10 - drf310: djangorestframework>=3.10.0,<3.11 drf311: djangorestframework>=3.11,<3.12 drf312: djangorestframework>=3.12,<3.13 drf313: djangorestframework>=3.13,<3.14 From 56e2b13e96f8cc899b4125c9393a17b38c28ae55 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Mon, 22 Jul 2024 09:01:52 +0200 Subject: [PATCH 10/13] Add back Python 3.12 to CI --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d018879..d2910d7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,7 +15,7 @@ jobs: - python-version: 3.9 - python-version: "3.10" - python-version: "3.11" - # - python-version: "3.12" + - python-version: "3.12" env: PYTHON: ${{ matrix.python-version }} From d501d24746e208ec345cc50fadad689e5ca12d52 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Mon, 22 Jul 2024 09:02:54 +0200 Subject: [PATCH 11/13] Upgrade codecov action --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d2910d7..95b52c8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -33,7 +33,7 @@ jobs: - name: Test with tox run: tox - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} env_vars: PYTHON From f147adf5b24fa850cf3e2971e57030d52adc2e50 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Mon, 22 Jul 2024 09:06:41 +0200 Subject: [PATCH 12/13] Update README and classifiers --- README.md | 6 +++--- setup.py | 6 +----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 4bf0faf..53dbce4 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ The following relations are supported: Requirements ============ -- Python (3.7, 3.8, 3.9, 3.10, 3.11, 3.12) -- Django (2.2, 3.0, 3.1, 3.2, 4.0, 4.1, 4.2, 5.0) -- djangorestframework (3.8+) +- Python (3.8, 3.9, 3.10, 3.11, 3.12) +- Django (3.2, 4.0, 4.1, 4.2, 5.0) +- djangorestframework (3.11+) Installation ============ diff --git a/setup.py b/setup.py index f1dfec6..3682599 100644 --- a/setup.py +++ b/setup.py @@ -39,14 +39,11 @@ def get_version(package): }, include_package_data=True, zip_safe=False, - python_requires='>=3.7', + python_requires='>=3.8', classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: Web Environment', 'Framework :: Django', - 'Framework :: Django :: 2.2', - 'Framework :: Django :: 3.0', - 'Framework :: Django :: 3.1', 'Framework :: Django :: 3.2', 'Framework :: Django :: 4.0', 'Framework :: Django :: 4.1', @@ -58,7 +55,6 @@ def get_version(package): 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', From fc2a87faa7d2694a30553f269a25704184ac4690 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Mon, 22 Jul 2024 09:20:47 +0200 Subject: [PATCH 13/13] Add support for DRF 3.15 and drop Django <4.2 --- README.md | 4 ++-- setup.py | 3 --- tox.ini | 19 +++++-------------- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 53dbce4..5af1290 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@ Requirements ============ - Python (3.8, 3.9, 3.10, 3.11, 3.12) -- Django (3.2, 4.0, 4.1, 4.2, 5.0) -- djangorestframework (3.11+) +- Django (4.2, 5.0) +- djangorestframework (3.14+) Installation ============ diff --git a/setup.py b/setup.py index 3682599..97da8f9 100644 --- a/setup.py +++ b/setup.py @@ -44,9 +44,6 @@ def get_version(package): 'Development Status :: 4 - Beta', 'Environment :: Web Environment', 'Framework :: Django', - 'Framework :: Django :: 3.2', - 'Framework :: Django :: 4.0', - 'Framework :: Django :: 4.1', 'Framework :: Django :: 4.2', 'Framework :: Django :: 5.0', 'Intended Audience :: Developers', diff --git a/tox.ini b/tox.ini index f237c61..40284c1 100644 --- a/tox.ini +++ b/tox.ini @@ -4,10 +4,9 @@ DJANGO_SETTINGS_MODULE = tests.settings [tox] envlist = - py{38,39,310,311}-dj{32}-drf{311,312,313,314}-pytest - py{38,39,310,311}-dj{40,41}-drf{313,314}-pytest - py{38,39,310,311,312}-dj{42}-drf{314}-{pytest,mypy} - py{310,311,312}-dj{50}-drf{314}-{pytest,mypy} + py{38,39,310,311,312}-dj42-drf{314,315}-pytest + py{310,311,312}-dj50-drf{314,315}-pytest + py312-dj50-drf315-mypy skip_missing_interpreters = true [gh-actions] @@ -18,9 +17,6 @@ python = 3.11: py311 3.12: py312 django = - 3.2: dj32 - 4.0: dj40 - 4.1: dj41 4.2: dj42 5.0: dj50 @@ -29,17 +25,12 @@ setenv = PYTHONDONTWRITEBYTECODE=1 PYTHONWARNINGS=once deps = - dj32: Django>=3.2a1,<4.0 - dj40: Django>=4.0,<4.1 - dj41: Django>=4.1,<4.2 dj42: Django>=4.2,<5.0 dj50: Django>=5.0,<5.1 - drf311: djangorestframework>=3.11,<3.12 - drf312: djangorestframework>=3.12,<3.13 - drf313: djangorestframework>=3.13,<3.14 drf314: djangorestframework>=3.14,<3.15 + drf315: djangorestframework>=3.15,<3.16 pytest: -rrequirements.txt - mypy: djangorestframework-stubs[compatible-mypy] + mypy: djangorestframework-stubs[compatible-mypy]>=3.15,<3.16 commands= pytest: pytest --cov drf_writable_nested --cov-report=xml mypy: mypy --show-traceback example