refactor: add support for python 3.14 (#1468)

This commit is contained in:
Juro Oravec 2025-10-22 00:35:34 +02:00 committed by GitHub
parent 28ff1d072a
commit e8aad681b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 171 additions and 17 deletions

View file

@ -1,8 +1,8 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/python-3 // https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/python-3
{ {
// Uncomment to run Python 3.13 or other specific version // Uncomment to run Python 3.14 or other specific version
// "image": "mcr.microsoft.com/devcontainers/python:3.13-bullseye", // "image": "mcr.microsoft.com/devcontainers/python:3.14-bullseye",
// Configure tool-specific properties. // Configure tool-specific properties.
"customizations": { "customizations": {

View file

@ -74,7 +74,7 @@ The package provides custom Django management commands:
### CI/CD Information ### CI/CD Information
- GitHub Actions workflow: `.github/workflows/tests.yml` - GitHub Actions workflow: `.github/workflows/tests.yml`
- Tests run on Python 3.8-3.13 with Django 4.2-5.2 - Tests run on Python 3.8-3.14 with Django 4.2-5.2
- Includes Playwright browser testing (requires `playwright install chromium --with-deps`) - Includes Playwright browser testing (requires `playwright install chromium --with-deps`)
- Documentation building uses mkdocs - Documentation building uses mkdocs
- Pre-commit hooks run ruff - Pre-commit hooks run ruff

View file

@ -13,7 +13,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
os: [ubuntu-latest, windows-latest] os: [ubuntu-latest, windows-latest]
steps: steps:
@ -34,10 +34,18 @@ jobs:
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
cache: "pip" cache: "pip"
- name: Install dependencies - name: Install dependencies (Python 3.8)
if: matrix.python-version == '3.8'
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-ci-python38.txt
- name: Install dependencies (Python > 3.8)
if: matrix.python-version != '3.8'
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
python -m pip install -r requirements-ci.txt python -m pip install -r requirements-ci.txt
- name: Install Playwright browsers
run: |
# See https://playwright.dev/python/docs/intro#installing-playwright-pytest # See https://playwright.dev/python/docs/intro#installing-playwright-pytest
playwright install chromium --with-deps playwright install chromium --with-deps
- name: Run tests - name: Run tests
@ -73,7 +81,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
python-version: ['3.13'] python-version: ['3.14']
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v5

View file

@ -107,6 +107,8 @@
#### Refactor #### Refactor
- Add support for Python 3.14
- Extension authors: The `ExtensionComponentConfig` can be instantiated with `None` instead of a component instance. - Extension authors: The `ExtensionComponentConfig` can be instantiated with `None` instead of a component instance.
This allows to call component-level extension methods outside of the normal rendering lifecycle. This allows to call component-level extension methods outside of the normal rendering lifecycle.

View file

@ -37,7 +37,8 @@ pyenv install -s 3.10
pyenv install -s 3.11 pyenv install -s 3.11
pyenv install -s 3.12 pyenv install -s 3.12
pyenv install -s 3.13 pyenv install -s 3.13
pyenv local 3.8 3.9 3.10 3.11 3.12 3.13 pyenv install -s 3.14
pyenv local 3.8 3.9 3.10 3.11 3.12 3.13 3.14
tox -p tox -p
``` ```

View file

@ -8,6 +8,7 @@ Django-components supports all supported combinations versions of [Django](https
| 3.11 | 4.2, 5.1, 5.2 | | 3.11 | 4.2, 5.1, 5.2 |
| 3.12 | 4.2, 5.1, 5.2 | | 3.12 | 4.2, 5.1, 5.2 |
| 3.13 | 5.1, 5.2 | | 3.13 | 5.1, 5.2 |
| 3.14 | 5.2 |
### Operating systems ### Operating systems

View file

@ -27,10 +27,11 @@ classifiers = [
"Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
] ]
dependencies = [ dependencies = [
'Django>=4.2', 'Django>=4.2',
'djc-core-html-parser>=1.0.2', 'djc-core-html-parser>=1.0.3',
'typing-extensions>=4.12.2', 'typing-extensions>=4.12.2',
] ]
license = { text = "MIT" } license = { text = "MIT" }

View file

@ -0,0 +1,118 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile requirements-ci.in
#
asv==0.6.5
# via -r requirements-ci.in
asv-runner==0.2.1
# via asv
build==1.2.2.post1
# via asv
cachetools==5.5.2
# via tox
certifi==2025.1.31
# via requests
chardet==5.2.0
# via tox
charset-normalizer==3.4.1
# via requests
colorama==0.4.6
# via tox
distlib==0.3.9
# via virtualenv
exceptiongroup==1.2.2
# via pytest
filelock==3.16.1
# via
# tox
# virtualenv
greenlet==3.1.1
# via playwright
idna==3.10
# via requests
importlib-metadata==8.5.0
# via
# asv
# asv-runner
# build
iniconfig==2.0.0
# via pytest
json5==0.10.0
# via asv
packaging==24.2
# via
# asv
# build
# pyproject-api
# pytest
# tox
pathspec==0.12.1
# via -r requirements-ci.in
platformdirs==4.3.6
# via
# tox
# virtualenv
playwright==1.48.0
# via -r requirements-ci.in
pluggy==1.5.0
# via
# pytest
# tox
pyee==12.0.0
# via playwright
pympler==1.1
# via asv
pyproject-api==1.8.0
# via tox
pyproject-hooks==1.2.0
# via build
pytest==8.3.5
# via
# pytest-asyncio
# pytest-django
pytest-asyncio==0.24.0
# via -r requirements-ci.in
pytest-django==4.11.1
# via -r requirements-ci.in
pyyaml==6.0.2
# via asv
requests==2.32.3
# via -r requirements-ci.in
tabulate==0.9.0
# via asv
tomli==2.2.1
# via
# asv
# build
# pyproject-api
# pytest
# tox
tox==4.25.0
# via
# -r requirements-ci.in
# tox-gh-actions
tox-gh-actions==3.4.0
# via -r requirements-ci.in
types-requests==2.32.0.20241016
# via -r requirements-ci.in
typing-extensions==4.13.2
# via
# -r requirements-ci.in
# pyee
# tox
# virtualenv
urllib3==2.2.3
# via
# requests
# types-requests
virtualenv==20.35.3
# via
# -r requirements-ci.in
# asv
# tox
whitenoise==6.7.0
# via -r requirements-ci.in
zipp==3.20.2
# via importlib-metadata

View file

@ -28,7 +28,7 @@ filelock==3.16.1
# via # via
# tox # tox
# virtualenv # virtualenv
greenlet==3.1.1 greenlet==3.2.4
# via playwright # via playwright
idna==3.10 idna==3.10
# via requests # via requests
@ -54,13 +54,13 @@ platformdirs==4.3.6
# via # via
# tox # tox
# virtualenv # virtualenv
playwright==1.48.0 playwright==1.55.0
# via -r requirements-ci.in # via -r requirements-ci.in
pluggy==1.5.0 pluggy==1.5.0
# via # via
# pytest # pytest
# tox # tox
pyee==12.0.0 pyee==13.0.0
# via playwright # via playwright
pympler==1.1 pympler==1.1
# via asv # via asv

View file

@ -36,7 +36,7 @@ django==4.2.25
# django-template-partials # django-template-partials
django-template-partials==25.2 django-template-partials==25.2
# via -r requirements-dev.in # via -r requirements-dev.in
djc-core-html-parser==1.0.2 djc-core-html-parser==1.0.3
# via -r requirements-dev.in # via -r requirements-dev.in
exceptiongroup==1.3.0 exceptiongroup==1.3.0
# via pytest # via pytest

View file

@ -42,7 +42,7 @@ defusedxml==0.7.1
# via cairosvg # via cairosvg
django==5.2.5 django==5.2.5
# via -r requirements-docs.in # via -r requirements-docs.in
djc-core-html-parser==1.0.2 djc-core-html-parser==1.0.3
# via -r requirements-docs.in # via -r requirements-docs.in
ghp-import==2.1.0 ghp-import==2.1.0
# via mkdocs # via mkdocs

31
tox.ini
View file

@ -7,6 +7,7 @@ envlist =
py{38,39}-django42 py{38,39}-django42
py{310,311,312}-django{42,51,52} py{310,311,312}-django{42,51,52}
py{313}-django{51,52} py{313}-django{51,52}
py{314}-django{52}
ruff ruff
coverage coverage
mypy mypy
@ -18,7 +19,8 @@ python =
3.10: py310-django{42,51,52} 3.10: py310-django{42,51,52}
3.11: py311-django{42,51,52} 3.11: py311-django{42,51,52}
3.12: py312-django{42,51,52} 3.12: py312-django{42,51,52}
3.13: py313-django{51,52}, ruff, coverage, mypy 3.13: py313-django{51,52}
3.14: py314-django{52}, ruff, coverage, mypy
isolated_build = true isolated_build = true
@ -29,7 +31,7 @@ deps =
django42: Django>=4.2,<4.3 django42: Django>=4.2,<4.3
django51: Django>=5.1,<5.2 django51: Django>=5.1,<5.2
django52: Django>=5.2,<5.3 django52: Django>=5.2,<5.3
djc-core-html-parser==1.0.2 djc-core-html-parser==1.0.3
pytest pytest
pytest-xdist pytest-xdist
pytest-django pytest-django
@ -38,7 +40,9 @@ deps =
# NOTE: Keep playwright is sync with the version in requirements-ci.txt # NOTE: Keep playwright is sync with the version in requirements-ci.txt
# Othrwise we get error: # Othrwise we get error:
# playwright._impl._errors.Error: BrowserType.launch: Executable doesn't exist at /home/runner/.cache/ms-playwright/chromium-1140/chrome-linux/chrome # playwright._impl._errors.Error: BrowserType.launch: Executable doesn't exist at /home/runner/.cache/ms-playwright/chromium-1140/chrome-linux/chrome
playwright==1.48.0 !py38: playwright==1.55.0
# For py38 run specific old version
py38: playwright==1.48.0
pydantic pydantic
requests requests
types-requests types-requests
@ -47,6 +51,25 @@ deps =
django-template-partials django-template-partials
commands = pytest {posargs} commands = pytest {posargs}
# TODO: Delete this when Django 4.2 reaches end of life
[testenv:py38-django42]
deps =
django42: Django>=4.2,<4.3
django51: Django>=5.1,<5.2
django52: Django>=5.2,<5.3
djc-core-html-parser==1.0.3
pytest
pytest-xdist
pytest-django
pytest-asyncio
syrupy # pytest snapshot testing
playwright==1.48.0
pydantic
requests
types-requests
whitenoise
django-template-partials
[testenv:ruff] [testenv:ruff]
deps = ruff deps = ruff
commands = commands =
@ -60,7 +83,7 @@ deps =
pytest-asyncio pytest-asyncio
syrupy # snapshot testing syrupy # snapshot testing
# NOTE: Keep playwright in sync with the version in requirements-ci.txt # NOTE: Keep playwright in sync with the version in requirements-ci.txt
playwright==1.48.0 playwright==1.55.0
pydantic pydantic
requests requests
types-requests types-requests