Skip to content

Conversation

@vinitkumar
Copy link
Member

@vinitkumar vinitkumar commented Dec 8, 2025

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:

  • Add explicit support for Django 6.0 and new Python versions (3.13, 3.14) across tox and CI test matrices.

Enhancements:

  • Raise the minimum supported Python version to 3.10 and refresh project classifiers and dependencies to match current support policy.
  • Switch CI and lint workflows to use uv for dependency and tool installation, improving performance and consistency.
  • Tighten type hints in helper utilities to use modern union syntax and more accurate parameter types.

Build:

  • Adjust tox environments to drop legacy Django/Python combinations and add environments for Django 5.0–6.0 on Python 3.10–3.14.
  • Add a new test requirements set for Django 6.0 with django CMS 5.0 and wire it into tox and GitHub Actions matrices.

CI:

  • Expand GitHub Actions test matrices to cover newer Python versions and Django 6.0 combinations, removing unsupported combos.
  • Update lint workflow to install and run ruff via uv instead of direct pip installs.
  • Update the Django/CMS main-branch CI job to run against a Django 6.0-style requirements set on Python 3.13.

Documentation:

  • Add AGENTS.md with guidance for AI assistants contributing to the project and document updated tooling and support ranges.

Tests:

  • Align test requirements files and matrices with the new Django/Python support policy, including the new Django 6.0 requirements set.

Chores:

  • Replace the django-fsm dependency with django-fsm-2 in project dependencies to reflect current usage.

vinitkumar and others added 23 commits October 25, 2025 03:30
- 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
…support' into feature/modernize-python-django-support
…support' into feature/modernize-python-django-support
Copilot AI review requested due to automatic review settings December 8, 2025 11:52
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 8, 2025

Reviewer's Guide

Updates 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 updates

classDiagram

    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
    }
Loading

Flow diagram for tox test environment matrix with Django 6.0 and Python 3.10–3.14

graph 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
Loading

File-Level Changes

Change Details Files
Expand and realign CI test matrix for newer Python versions and Django 6.0, and switch CI dependency installation to uv.
  • Update GitHub Actions test workflows to test Python 3.10–3.14 instead of 3.9–3.12
  • Add new Django 6.0 + django CMS 5.0 requirements file to the test matrix and adjust matrix exclusions accordingly
  • Install uv in CI and replace pip-based install/uninstall commands with uv pip/uvx equivalents for dependencies, project installation, and django/django-cms combinations
.github/workflows/test.yml
Modernize tox environments to align with supported Python/Django versions including Django 6.0.
  • Replace legacy py39/old Django envs with py310–py314 and Django 4.2–5.2 combinations
  • Introduce separate tox environments for Django 6.0 and for Django main + CMS develop4
  • Update tox dependency factor mapping to point to new per-Django requirement files including the new Django 6.0 file
  • Add basepython mappings for Python 3.12–3.14
tox.ini
Tighten package metadata and dependencies to Python 3.10+ and reflect support for Django 6.0 and modern dependency choices.
  • Raise requires-python to >=3.10 and add explicit Python 3.10–3.14 classifiers
  • Add Django 6.0 classifier and remove the explicit Django>=4.2 runtime dependency in favor of django-cms constraints
  • Replace django-fsm<3 with django-fsm-2 in the dependency list
pyproject.toml
Update lint workflow to use uv tooling for ruff.
  • Install uv in lint workflow
  • Install ruff using uv tool and invoke it via uvx instead of calling ruff directly
.github/workflows/lint.yml
Minor typing and helper API cleanup to better support modern typing conventions.
  • Change replace_admin_for_models to accept an Iterable of (model, mixin) instead of a fixed tuple, and update the docstring parameter name accordingly
  • Simplify Conditions.get return type annotation to use PEP 604 union syntax
djangocms_versioning/helpers.py
djangocms_versioning/conditions.py
Document guidance for AI assistants and add Django 6.0 test requirements.
  • Add AGENTS.md with project overview, workflows, and conventions aimed at AI assistants
  • Introduce a new tests/requirements/dj60_cms50.txt file and adjust other requirement files as needed for the new Django 6.0 + CMS 5.0 combination
AGENTS.md
tests/requirements/dj60_cms50.txt
tests/requirements/dj42_cms41.txt
tests/requirements/dj50_cms41.txt
tests/requirements/dj51_cms41.txt
tests/requirements/dj52_cms41.txt
tests/requirements/dj52_cms50.txt
tests/requirements/requirements_base.txt
README.rst
djangocms_versioning/indicators.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a 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 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.
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.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

Copilot AI left a 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-fsm to django-fsm-2 for better maintenance and support
  • Modernizes type hints to use PEP 604 syntax (X | Y instead of Union[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
Copy link

Copilot AI Dec 8, 2025

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.

Suggested change
- django-fsm < 3

Copilot uses AI. Check for mistakes.
Comment on lines +55 to +59
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
Copy link

Copilot AI Dec 8, 2025

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
Comment on lines +55 to +56
sudo apt install gettext gcc -y
sudo apt install gettext gcc -y
Copy link

Copilot AI Dec 8, 2025

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.

Suggested change
sudo apt install gettext gcc -y
sudo apt install gettext gcc -y

Copilot uses AI. Check for mistakes.
@vinitkumar vinitkumar changed the title Replace Django 6.0a1 with 6.0 in test requirements chore: Replace Django 6.0a1 with 6.0 in test requirements Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants