From 44b972b775dea9438b67610e4a418316dadca878 Mon Sep 17 00:00:00 2001 From: Marti Raudsepp Date: Fri, 6 Oct 2023 02:13:28 +0300 Subject: [PATCH 1/2] CI: Enable testing with Python 3.12 This requires removing the `setuptools` version constraint from `[build-system]` in `pyproject.toml`. --- .github/workflows/test.yml | 10 +++++----- .pre-commit-config.yaml | 2 +- CONTRIBUTING.md | 2 +- README.md | 1 + ext/setup.py | 1 + pyproject.toml | 2 +- setup.py | 1 + 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3be2b41d9..34cb1e225 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] fail-fast: false steps: - uses: actions/checkout@v4 @@ -48,7 +48,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] shard: [0, 1, 2, 3] fail-fast: false steps: @@ -75,7 +75,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.11'] + python-version: ['3.12'] fail-fast: false steps: - uses: actions/checkout@v4 @@ -101,10 +101,10 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.8', '3.9', '3.10'] + python-version: ['3.8', '3.9', '3.10', '3.11'] django-version: ['3.2', '4.2'] include: - - python-version: '3.11' + - python-version: '3.12' django-version: '4.1' steps: - uses: actions/checkout@v4 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7b135d481..8e2993c8f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks default_language_version: - python: python3.11 + python: python3.12 repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 23ff780de..7c2d998a3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -88,7 +88,7 @@ We have two special files to allow errors: You might also want to disable `incremental` mode while working on `stubtest` changes. This mode leads to several known problems (stubs do not show up or have strange errors). -**Important**: right now we only run `stubtest` on Python 3.11 (because it is the latest released version at the moment), any other versions might generate different outputs. Any work to create per-version allowlists is welcome. +**Important**: right now we only run `stubtest` on Python 3.12 (because it is the latest released version at the moment), any other versions might generate different outputs. Any work to create per-version allowlists is welcome. ## Submission Guidelines diff --git a/README.md b/README.md index c2241fd43..87ec49048 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ We rely on different `django` and `mypy` versions: | django-stubs | Mypy version | Django version | Django partial support | Python version | |----------------|--------------|----------------|------------------------|----------------| +| (next release) | 1.5.x | 4.2 | 4.1, 3.2 | 3.8 - 3.12 | | 4.2.4 | 1.5.x | 4.2 | 4.1, 3.2 | 3.8 - 3.11 | | 4.2.3 | 1.4.x | 4.2 | 4.1, 3.2 | 3.8 - 3.11 | | 4.2.2 | 1.4.x | 4.2 | 4.1, 3.2 | 3.8 - 3.11 | diff --git a/ext/setup.py b/ext/setup.py index b7662622b..7a730d474 100755 --- a/ext/setup.py +++ b/ext/setup.py @@ -38,6 +38,7 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Typing :: Typed", "Framework :: Django", "Framework :: Django :: 3.2", diff --git a/pyproject.toml b/pyproject.toml index 305c8d865..510a37bf1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,4 +32,4 @@ known-first-party = ["django_stubs_ext", "mypy_django_plugin"] split-on-trailing-comma = false [build-system] -requires = ["setuptools<64", "wheel"] +requires = ["setuptools", "wheel"] diff --git a/setup.py b/setup.py index 76aa663b0..34b1af6f0 100644 --- a/setup.py +++ b/setup.py @@ -65,6 +65,7 @@ def find_stub_files(name: str) -> List[str]: "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Typing :: Typed", "Framework :: Django", "Framework :: Django :: 3.2", From d6669e0477b655151215f25800023ea7981123e3 Mon Sep 17 00:00:00 2001 From: Marti Raudsepp Date: Fri, 6 Oct 2023 02:21:01 +0300 Subject: [PATCH 2/2] Try solution from PR 1122, thanks andersk! --- .github/workflows/test.yml | 8 ++++---- CONTRIBUTING.md | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 34cb1e225..3efae77ef 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,7 +31,7 @@ jobs: - name: Install dependencies run: | pip install -U pip setuptools wheel - pip install -r ./requirements.txt + SETUPTOOLS_ENABLE_FEATURES=legacy-editable pip install -r ./requirements.txt - name: Run mypy on plugin code run: mypy --strict mypy_django_plugin @@ -64,7 +64,7 @@ jobs: - name: Install dependencies run: | pip install -U pip setuptools wheel - pip install -r ./requirements.txt + SETUPTOOLS_ENABLE_FEATURES=legacy-editable pip install -r ./requirements.txt # Must match `shard` definition in the test matrix: - name: Run tests @@ -90,7 +90,7 @@ jobs: - name: Install dependencies run: | pip install -U pip setuptools wheel - pip install -r ./requirements.txt + SETUPTOOLS_ENABLE_FEATURES=legacy-editable pip install -r ./requirements.txt - name: Run stubtest run: bash ./scripts/stubtest.sh @@ -119,7 +119,7 @@ jobs: - name: Install dependencies run: | pip install -U pip setuptools wheel - pip install -r ./requirements.txt + SETUPTOOLS_ENABLE_FEATURES=legacy-editable pip install -r ./requirements.txt pip install "Django==${{ matrix.django-version }}" pip check diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7c2d998a3..4d4089ea1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,7 +44,7 @@ source .venv/bin/activate Then install the dev requirements: ```bash -pip install -r ./requirements.txt +SETUPTOOLS_ENABLE_FEATURES=legacy-editable pip install -r ./requirements.txt ``` Finally, install the pre-commit hooks: