-
Notifications
You must be signed in to change notification settings - Fork 34
chore: Replace Django 6.0a1 with 6.0 in test requirements #506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- 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]>
- 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]>
- 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
- 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
- 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]>
- 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
- 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'
- Break function signature across multiple lines to comply with 120 char limit - Fixes ruff E501 error
Amp-Thread-ID: https://ampcode.com/threads/T-6e53f75e-8813-4ef9-bcd2-61db1b0e0cc6 Co-authored-by: Amp <[email protected]>
Amp-Thread-ID: https://ampcode.com/threads/T-7c01575b-a01e-4212-bfb3-f4981bd1583b Co-authored-by: Amp <[email protected]>
Amp-Thread-ID: https://ampcode.com/threads/T-1ae0efd4-afab-468c-b53b-30d0573c635e Co-authored-by: Amp <[email protected]>
…support' into feature/modernize-python-django-support
…support' into feature/modernize-python-django-support
Reviewer's GuideUpdates supported Python/Django matrix and tooling to target Django 6.0 and Python 3.10–3.14, migrates CI/tox/lint flows to uv, tightens Python/Django metadata, and makes a couple of small typing cleanups plus new docs for AI agents. Class diagram for Conditions and helpers typing updatesclassDiagram
class Conditions {
+__add__(other list) Conditions
+__get__(instance object, cls object) Conditions \| BoundConditions
}
class BoundConditions {
}
Conditions <|-- BoundConditions
class HelpersModule {
+replace_admin_for_models(pairs Iterable~tuple~ , admin_site admin.AdminSite \| None) None
}
Flow diagram for tox test environment matrix with Django 6.0 and Python 3.10–3.14graph TD
A["Invoke tox"] --> B["Select environment from envlist"]
subgraph Environments
E1["py310-dj42-sqlite"]
E2["py311-dj42-sqlite"]
E3["py312-dj42-sqlite"]
E4["py313-dj42-sqlite"]
E5["py314-dj42-sqlite"]
E6["py310-dj50-sqlite"]
E7["py311-dj50-sqlite"]
E8["py312-dj50-sqlite"]
E9["py313-dj50-sqlite"]
E10["py314-dj50-sqlite"]
E11["py310-dj51-sqlite"]
E12["py311-dj51-sqlite"]
E13["py312-dj51-sqlite"]
E14["py313-dj51-sqlite"]
E15["py314-dj51-sqlite"]
E16["py310-dj52-sqlite"]
E17["py311-dj52-sqlite"]
E18["py312-dj52-sqlite"]
E19["py313-dj52-sqlite"]
E20["py314-dj52-sqlite"]
E21["py312-dj60-sqlite"]
E22["py313-dj60-sqlite"]
E23["py314-dj60-sqlite"]
E24["py312-djmain-cms-develop4-sqlite"]
E25["py313-djmain-cms-develop4-sqlite"]
end
B --> E1
B --> E2
B --> E3
B --> E4
B --> E5
B --> E6
B --> E7
B --> E8
B --> E9
B --> E10
B --> E11
B --> E12
B --> E13
B --> E14
B --> E15
B --> E16
B --> E17
B --> E18
B --> E19
B --> E20
B --> E21
B --> E22
B --> E23
B --> E24
B --> E25
subgraph BasePython
P310["py310 -> python3.10"]
P311["py311 -> python3.11"]
P312["py312 -> python3.12"]
P313["py313 -> python3.13"]
P314["py314 -> python3.14"]
end
E1 --> P310
E6 --> P310
E11 --> P310
E16 --> P310
E2 --> P311
E7 --> P311
E12 --> P311
E17 --> P311
E3 --> P312
E8 --> P312
E13 --> P312
E18 --> P312
E21 --> P312
E24 --> P312
E4 --> P313
E9 --> P313
E14 --> P313
E19 --> P313
E22 --> P313
E25 --> P313
E5 --> P314
E10 --> P314
E15 --> P314
E20 --> P314
E23 --> P314
subgraph DjangoDeps
D42["dj42 -> dj42_cms41 requirements"]
D50["dj50 -> dj50_cms41 requirements"]
D51["dj51 -> dj51_cms41 requirements"]
D52["dj52 -> dj52_cms50 requirements"]
D60["dj60 -> dj60_cms50 requirements"]
DMain["djmain -> Django main tarball"]
DCMSDev4["develop4 -> django_cms develop_4 tarball"]
end
E1 --> D42
E2 --> D42
E3 --> D42
E4 --> D42
E5 --> D42
E6 --> D50
E7 --> D50
E8 --> D50
E9 --> D50
E10 --> D50
E11 --> D51
E12 --> D51
E13 --> D51
E14 --> D51
E15 --> D51
E16 --> D52
E17 --> D52
E18 --> D52
E19 --> D52
E20 --> D52
E21 --> D60
E22 --> D60
E23 --> D60
E24 --> DMain
E24 --> DCMSDev4
E25 --> DMain
E25 --> DCMSDev4
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- In djangocms_versioning/helpers.py you changed the type of
pairstoIterable[...]but didn’t add an import forIterable(e.g.from collections.abc import Iterable), which will raise a NameError at runtime. - The GitHub Actions test workflow has several duplicated commands in the "Install dependencies" step (multiple identical
apt install gettext gcc -yandpython -m pip install --upgrade pip uvlines); these should be consolidated to a single invocation of each. - The updated CI matrices (e.g. in
.github/workflows/test.yml) contain some redundantexcludeentries for the same (python-version, requirements-file) combinations; consider deduplicating these to keep the matrix definitions easier to understand and maintain.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In djangocms_versioning/helpers.py you changed the type of `pairs` to `Iterable[...]` but didn’t add an import for `Iterable` (e.g. `from collections.abc import Iterable`), which will raise a NameError at runtime.
- The GitHub Actions test workflow has several duplicated commands in the "Install dependencies" step (multiple identical `apt install gettext gcc -y` and `python -m pip install --upgrade pip uv` lines); these should be consolidated to a single invocation of each.
- The updated CI matrices (e.g. in `.github/workflows/test.yml`) contain some redundant `exclude` entries for the same (python-version, requirements-file) combinations; consider deduplicating these to keep the matrix definitions easier to understand and maintain.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR updates the project's test infrastructure to support Django 6.0 (stable release, replacing the alpha version 6.0a1) and modernizes Python version support by dropping Python 3.9 and adding support for Python 3.12-3.13. The changes include updating test matrices across GitHub Actions workflows, migrating from django-fsm to django-fsm-2, upgrading dependencies, and adopting modern Python type hint syntax (PEP 604 union operators).
Key changes:
- Updates minimum Python version from 3.6 to 3.10 and adds Django 6.0 support
- Migrates from
django-fsmtodjango-fsm-2for better maintenance and support - Modernizes type hints to use PEP 604 syntax (
X | Yinstead ofUnion[X, Y])
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tox.ini | Updated Python versions (3.10-3.14) and Django test matrices (4.2-6.0); added dj60 requirements |
| tests/requirements/*.txt | Updated mysqlclient version; migrated all requirement files to django-fsm-2==4.1.0; added dj60_cms50.txt |
| pyproject.toml | Updated minimum Python to 3.10; added Django 6.0 and Python 3.10-3.14 classifiers; switched to django-fsm-2 |
| djangocms_versioning/indicators.py | Removed from __future__ import annotations (no longer needed with Python 3.10+) |
| djangocms_versioning/helpers.py | Updated type hints to use modern syntax with Iterable and fixed parameter documentation |
| djangocms_versioning/conditions.py | Replaced typing.Union with PEP 604 union syntax (`X |
| README.rst | Added note explaining migration to django-fsm-2 |
| AGENTS.md | New documentation file for AI assistants with project conventions and commands |
| .github/workflows/test.yml | Updated test matrices for new Python/Django versions; migrated to uv package manager |
| .github/workflows/lint.yml | Migrated linting to use uv tool installation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ### Python | ||
| - Django >= 4.2 | ||
| - django-cms >= 4.1.1 | ||
| - django-fsm < 3 |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent dependency information. Line 152 lists django-fsm < 3 while line 153 lists django-fsm-2==4.1.0. According to pyproject.toml, the project now uses django-fsm-2 (not django-fsm < 3). Line 152 should be removed as it refers to the old dependency that has been replaced.
| - django-fsm < 3 |
| sudo apt install gettext gcc -y | ||
| sudo apt install gettext gcc -y | ||
| python -m pip install --upgrade pip uv | ||
| python -m pip install --upgrade pip uv | ||
| python -m pip install --upgrade pip uv |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These three lines are identical duplicates. This appears to be a copy-paste error. Remove two of these duplicate lines.
| sudo apt install gettext gcc -y | |
| sudo apt install gettext gcc -y | |
| python -m pip install --upgrade pip uv | |
| python -m pip install --upgrade pip uv | |
| python -m pip install --upgrade pip uv | |
| python -m pip install --upgrade pip uv |
| sudo apt install gettext gcc -y | ||
| sudo apt install gettext gcc -y |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These three lines are identical duplicates. This appears to be a copy-paste error. Remove two of these duplicate lines.
| sudo apt install gettext gcc -y | |
| sudo apt install gettext gcc -y |
Updates the test requirements to use Django 6.0 instead of 6.0a1
Summary by Sourcery
Update supported Python/Django matrix and tooling to target Python 3.10+ and Django up to 6.0, while modernizing CI, packaging metadata, and helper typings.
New Features:
Enhancements:
Build:
CI:
Documentation:
Tests:
Chores: