Skip to content

Commit a0db3de

Browse files
vinitkumarampcode-comfsbraun
authored
Modernize Python and Django support: Drop Python 3.9, add Python 3.14 and Django 6.0 (#489)
* Drop Python 3.9 support, add Python 3.14 and Django 6.0 support - Update pyproject.toml: requires-python >= 3.10, add classifiers for Python 3.10-3.14 and Django 6.0 - Update tox.ini: remove py39, add py310, py312, py313, py314 - Update GitHub Actions workflows: add Python 3.14 and Django 6.0 test configurations - Add dj60_cms50.txt requirements file for Django 6.0 testing - Add exclusions to prevent Python 3.14 from running against older Django versions Amp-Thread-ID: https://ampcode.com/threads/T-cdf01cfa-6da3-4851-9a9b-0c7a2c181c37 Co-authored-by: Amp <[email protected]> * Modernize type annotations for Python 3.10+ - Replace typing.Union[X, Y] with X | Y syntax (PEP 604) - Replace typing.Optional[X] with X | None syntax - Remove unnecessary typing imports where Optional/Union were the only imports - Updated files: admin.py, emails.py, conditions.py, helpers.py, cms_toolbars.py, indicators.py, datastructures.py Amp-Thread-ID: https://ampcode.com/threads/T-cdf01cfa-6da3-4851-9a9b-0c7a2c181c37 Co-authored-by: Amp <[email protected]> * Remove unused typing imports after modernization - Removed unused typing imports from admin.py, conditions.py, emails.py, and indicators.py - These imports became unused after migrating to PEP 604 union syntax * Update AGENTS.md with new Python and Django version requirements - Updated Python version requirement from 3.9+ to 3.10+ - Added Django 6.0 to supported versions - Updated test matrix to reflect Python 3.10-3.14 - Added note about PEP 604 union syntax in type hints * Use uv for package management in CI workflows - Replace pip with uv for faster dependency installation - Add astral-sh/setup-uv@v5 action to all workflows - Use 'uv pip install --system' for package installation - Use 'uvx ruff' for linting workflow - Updated all test jobs: sqlite, postgres, mysql, cms-develop, django-main Amp-Thread-ID: https://ampcode.com/threads/T-cdf01cfa-6da3-4851-9a9b-0c7a2c181c37 Co-authored-by: Amp <[email protected]> * Update AGENTS.md to reflect usage of uv [skip ci] - Add note about using uv for faster dependency installation - Update testing command to use 'uv pip install' - Document uv as the package manager in Code Style section * Fix type hint for replace_admin_for_models pairs parameter - Change from 'tuple[type[models.Model], type]' to 'Iterable[tuple[type[models.Model], type]]' - The function expects multiple pairs, not a single tuple - Also fixed docstring parameter name from 'models' to 'pairs' * Fix line length in replace_admin_for_models signature - Break function signature across multiple lines to comply with 120 char limit - Fixes ruff E501 error * Fix test matrix: Django 6 now only runs with Python 3.12+ Amp-Thread-ID: https://ampcode.com/threads/T-6e53f75e-8813-4ef9-bcd2-61db1b0e0cc6 Co-authored-by: Amp <[email protected]> * Update Django requirement to >=6.0a1,<6.1 Amp-Thread-ID: https://ampcode.com/threads/T-7c01575b-a01e-4212-bfb3-f4981bd1583b Co-authored-by: Amp <[email protected]> * Update Django requirement to >=6.0a1,<6.1 Amp-Thread-ID: https://ampcode.com/threads/T-1ae0efd4-afab-468c-b53b-30d0573c635e Co-authored-by: Amp <[email protected]> * fix: issues with matrix * fix: wrong Django version in pyproject.toml * fix: mysqlclient errors with python 3.14 * replace: django-fsm with django-fsm-2 that comes with django 6.0 support * fix: remove version constraints and also add a note in the readme * fix: links --------- Co-authored-by: Amp <[email protected]> Co-authored-by: Fabian Braun <[email protected]>
1 parent 27abc23 commit a0db3de

File tree

16 files changed

+328
-64
lines changed

16 files changed

+328
-64
lines changed

.github/workflows/lint.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v5
1313

14-
- run: python -Im pip install --user ruff
14+
- name: Install uv
15+
uses: astral-sh/setup-uv@v5
16+
17+
- name: Install ruff
18+
run: uv tool install ruff
1519

1620
- name: Run ruff
17-
run: ruff check --output-format=github djangocms_versioning tests
21+
run: uvx ruff check --output-format=github djangocms_versioning tests

.github/workflows/test.yml

Lines changed: 97 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,53 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
python-version: [ 3.9, "3.10", "3.11", "3.12" ]
15+
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
1616
requirements-file: [
1717
dj42_cms41.txt,
1818
dj50_cms41.txt,
1919
dj51_cms41.txt,
2020
dj52_cms41.txt,
2121
dj52_cms50.txt,
22+
dj60_cms50.txt,
2223
]
2324
exclude:
25+
- requirements-file: dj52_cms41.txt
26+
python-version: "3.10"
27+
- requirements-file: dj52_cms50.txt
28+
python-version: "3.10"
29+
- requirements-file: dj60_cms50.txt
30+
python-version: "3.10"
31+
- requirements-file: dj60_cms50.txt
32+
python-version: "3.11"
33+
- requirements-file: dj42_cms41.txt
34+
python-version: "3.14"
2435
- requirements-file: dj50_cms41.txt
25-
python-version: 3.9
36+
python-version: "3.14"
2637
- requirements-file: dj51_cms41.txt
27-
python-version: 3.9
38+
python-version: "3.14"
2839
- requirements-file: dj52_cms41.txt
29-
python-version: 3.9
30-
- requirements-file: dj52_cms41.txt
31-
python-version: 3.10
32-
- requirements-file: dj52_cms50.txt
33-
python-version: 3.9
40+
python-version: "3.14"
3441
- requirements-file: dj52_cms50.txt
35-
python-version: 3.10
42+
python-version: "3.14"
3643

3744
steps:
3845
- uses: actions/checkout@v5
3946
- name: Set up Python ${{ matrix.python-version }}
40-
4147
uses: actions/setup-python@v6
4248
with:
4349
python-version: ${{ matrix.python-version }}
50+
- name: Install uv
51+
uses: astral-sh/setup-uv@v5
4452
- name: Install dependencies
4553
run: |
46-
python -m pip install --upgrade pip
47-
pip install -r tests/requirements/${{ matrix.requirements-file }}
48-
pip install -e .
54+
sudo apt install gettext gcc -y
55+
sudo apt install gettext gcc -y
56+
sudo apt install gettext gcc -y
57+
python -m pip install --upgrade pip uv
58+
python -m pip install --upgrade pip uv
59+
python -m pip install --upgrade pip uv
60+
uv pip install --system -r tests/requirements/${{ matrix.requirements-file }}
61+
uv pip install --system -e .
4962
5063
- name: Run coverage
5164
run: coverage run ./test_settings.py
@@ -58,12 +71,36 @@ jobs:
5871
strategy:
5972
fail-fast: false
6073
matrix:
61-
python-version: [ "3.11", "3.12", "3.13" ]
74+
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
6275
requirements-file: [
6376
dj42_cms41.txt,
77+
dj50_cms41.txt,
78+
dj51_cms41.txt,
6479
dj52_cms41.txt,
6580
dj52_cms50.txt,
66-
]
81+
dj60_cms50.txt,
82+
]
83+
exclude:
84+
- requirements-file: dj52_cms41.txt
85+
python-version: "3.10"
86+
- requirements-file: dj52_cms50.txt
87+
python-version: "3.10"
88+
- requirements-file: dj60_cms50.txt
89+
python-version: "3.10"
90+
- requirements-file: dj60_cms50.txt
91+
python-version: "3.11"
92+
- requirements-file: dj42_cms41.txt
93+
python-version: "3.14"
94+
- requirements-file: dj50_cms41.txt
95+
python-version: "3.14"
96+
- requirements-file: dj51_cms41.txt
97+
python-version: "3.14"
98+
- requirements-file: dj52_cms41.txt
99+
python-version: "3.14"
100+
- requirements-file: dj52_cms50.txt
101+
python-version: "3.14"
102+
- requirements-file: dj60_cms50.txt
103+
python-version: "3.14"
67104

68105
services:
69106
postgres:
@@ -80,15 +117,15 @@ jobs:
80117
steps:
81118
- uses: actions/checkout@v5
82119
- name: Set up Python ${{ matrix.python-version }}
83-
84120
uses: actions/setup-python@v6
85121
with:
86122
python-version: ${{ matrix.python-version }}
123+
- name: Install uv
124+
uses: astral-sh/setup-uv@v5
87125
- name: Install dependencies
88126
run: |
89-
python -m pip install --upgrade pip
90-
pip install -r tests/requirements/${{ matrix.requirements-file }}
91-
python setup.py install
127+
uv pip install --system -r tests/requirements/${{ matrix.requirements-file }}
128+
uv pip install --system .
92129
93130
- name: Run coverage
94131
run: coverage run ./test_settings.py
@@ -103,17 +140,36 @@ jobs:
103140
strategy:
104141
fail-fast: false
105142
matrix:
106-
python-version: [ "3.11", "3.12", "3.13" ]
143+
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
107144
requirements-file: [
108145
dj42_cms41.txt,
146+
dj50_cms41.txt,
147+
dj51_cms41.txt,
109148
dj52_cms41.txt,
110149
dj52_cms50.txt,
111-
]
150+
dj60_cms50.txt,
151+
]
112152
exclude:
153+
- requirements-file: dj52_cms41.txt
154+
python-version: "3.10"
155+
- requirements-file: dj52_cms50.txt
156+
python-version: "3.10"
157+
- requirements-file: dj60_cms50.txt
158+
python-version: "3.10"
159+
- requirements-file: dj60_cms50.txt
160+
python-version: "3.11"
161+
- requirements-file: dj42_cms41.txt
162+
python-version: "3.14"
113163
- requirements-file: dj50_cms41.txt
114-
python-version: 3.9
164+
python-version: "3.14"
115165
- requirements-file: dj51_cms41.txt
116-
python-version: 3.9
166+
python-version: "3.14"
167+
- requirements-file: dj52_cms41.txt
168+
python-version: "3.14"
169+
- requirements-file: dj52_cms50.txt
170+
python-version: "3.14"
171+
- requirements-file: dj60_cms50.txt
172+
python-version: "3.14"
117173

118174
services:
119175
mysql:
@@ -128,15 +184,15 @@ jobs:
128184
steps:
129185
- uses: actions/checkout@v5
130186
- name: Set up Python ${{ matrix.python-version }}
131-
132187
uses: actions/setup-python@v6
133188
with:
134189
python-version: ${{ matrix.python-version }}
190+
- name: Install uv
191+
uses: astral-sh/setup-uv@v5
135192
- name: Install dependencies
136193
run: |
137-
python -m pip install --upgrade pip
138-
pip install -r tests/requirements/${{ matrix.requirements-file }}
139-
python setup.py install
194+
uv pip install --system -r tests/requirements/${{ matrix.requirements-file }}
195+
uv pip install --system .
140196
141197
- name: Run coverage
142198
run: coverage run ./test_settings.py
@@ -163,17 +219,17 @@ jobs:
163219
steps:
164220
- uses: actions/checkout@v5
165221
- name: Set up Python ${{ matrix.python-version }}
166-
167222
uses: actions/setup-python@v6
168223
with:
169224
python-version: ${{ matrix.python-version }}
225+
- name: Install uv
226+
uses: astral-sh/setup-uv@v5
170227
- name: Install dependencies
171228
run: |
172-
python -m pip install --upgrade pip
173-
python -m pip install -r tests/requirements/${{ matrix.requirements-file }}
174-
python -m pip uninstall -y django-cms
175-
python -m pip install ${{ matrix.cms-version }}
176-
python setup.py install
229+
uv pip install --system -r tests/requirements/${{ matrix.requirements-file }}
230+
uv pip uninstall --system django-cms
231+
uv pip install --system ${{ matrix.cms-version }}
232+
uv pip install --system .
177233
178234
- name: Run coverage
179235
run: coverage run ./test_settings.py
@@ -186,29 +242,29 @@ jobs:
186242
strategy:
187243
fail-fast: false
188244
matrix:
189-
python-version: [ "3.12" ]
245+
python-version: [ "3.13" ]
190246
cms-version: [
191247
'https://github.com/django-cms/django-cms/archive/main.tar.gz'
192248
]
193249
django-version: [
194250
'https://github.com/django/django/archive/main.tar.gz'
195251
]
196-
requirements-file: ['dj52_cms50.txt']
252+
requirements-file: ['dj60_cms50.txt']
197253

198254
steps:
199255
- uses: actions/checkout@v5
200256
- name: Set up Python ${{ matrix.python-version }}
201-
202257
uses: actions/setup-python@v6
203258
with:
204259
python-version: ${{ matrix.python-version }}
260+
- name: Install uv
261+
uses: astral-sh/setup-uv@v5
205262
- name: Install dependencies
206263
run: |
207-
python -m pip install --upgrade pip
208-
python -m pip install -r tests/requirements/${{ matrix.requirements-file }}
209-
python -m pip uninstall -y Django django-cms
210-
python -m pip install ${{ matrix.cms-version }} ${{ matrix.django-version }}
211-
python setup.py install
264+
uv pip install --system -r tests/requirements/${{ matrix.requirements-file }}
265+
uv pip uninstall --system Django django-cms
266+
uv pip install --system ${{ matrix.cms-version }} ${{ matrix.django-version }}
267+
uv pip install --system .
212268
213269
- name: Run coverage
214270
run: coverage run ./test_settings.py

0 commit comments

Comments
 (0)