Upgrade to Python 3.13

This commit is contained in:
Bruno Alla 2025-09-20 00:05:31 +01:00
parent aaec141b7e
commit 9e8761c267
23 changed files with 310 additions and 358 deletions

View File

@ -96,7 +96,7 @@ jobs:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: "3.12"
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Install dependencies

View File

@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: "3.12"
python-version: "3.13"
- name: Install pre-commit
run: pip install pre-commit

View File

@ -3,7 +3,7 @@ default_stages: [pre-commit]
minimum_pre_commit_version: "3.2.0"
default_language_version:
python: python3.12
python: python3.13
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks

View File

@ -8,7 +8,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.12"
python: "3.13"
commands:
- asdf plugin add uv
- asdf install uv latest

View File

@ -18,7 +18,7 @@ This last step is very important, don't start developing from main, it'll cause
## Testing
You'll need to run the tests using Python 3.12. We recommend using [tox](https://tox.readthedocs.io/en/latest/) to run the tests. It will automatically create a fresh virtual environment and install our test dependencies, such as [pytest-cookies](https://pypi.python.org/pypi/pytest-cookies/) and [flake8](https://pypi.python.org/pypi/flake8/).
You'll need to run the tests using Python 3.13. We recommend using [tox](https://tox.readthedocs.io/en/latest/) to run the tests. It will automatically create a fresh virtual environment and install our test dependencies, such as [pytest-cookies](https://pypi.python.org/pypi/pytest-cookies/) and [flake8](https://pypi.python.org/pypi/flake8/).
We'll also run the tests on GitHub actions when you send your pull request, but it's a good idea to run them locally before you send it.

View File

@ -20,7 +20,7 @@ production-ready Django projects quickly.
## Features
- For Django 5.2
- Works with Python 3.12
- Works with Python 3.13
- Renders Django projects with 100% starting test coverage
- Twitter [Bootstrap](https://github.com/twbs/bootstrap) v5
- [12-Factor](https://12factor.net) based settings via [django-environ](https://github.com/joke2k/django-environ)

View File

@ -110,7 +110,7 @@ We recommend to signup to a separate service offering hosted Redis (e.g. `Redisl
Configure the PythonAnywhere Web Tab
------------------------------------
Go to the PythonAnywhere **Web tab**, hit **Add new web app**, and choose **Manual Config**, and then the Pthon 3.12.
Go to the PythonAnywhere **Web tab**, hit **Add new web app**, and choose **Manual Config**, and then the Python 3.13.
.. note:: If you're using a custom domain (not on \*.pythonanywhere.com), then you'll need to set up a CNAME with your domain registrar.

View File

@ -14,7 +14,7 @@ license = { text = "BSD" }
authors = [
{ name = "Daniel Roy Greenfeld", email = "pydanny@gmail.com" },
]
requires-python = ">=3.12,<3.13"
requires-python = "==3.13.*"
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
@ -24,7 +24,7 @@ classifiers = [
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development",
]

View File

@ -1,6 +1,6 @@
[tox]
skipsdist = true
envlist = py312
envlist = py313
[testenv]
passenv = AUTOFIXABLE_STYLES

609
uv.lock

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@ environment:
steps:
- name: lint
pull: if-not-exists
image: ghcr.io/astral-sh/uv:python3.12
image: ghcr.io/astral-sh/uv:python3.13
environment:
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
volumes:
@ -37,7 +37,7 @@ steps:
- docker-compose -f docker-compose.local.yml up -d
- docker-compose -f docker-compose.local.yml run django pytest
{%- else %}
image: ghcr.io/astral-sh/uv:python3.12
image: ghcr.io/astral-sh/uv:python3.13
commands:
- uv sync --locked
- uv run pytest

View File

@ -13,7 +13,7 @@ variables:
precommit:
stage: lint
image: ghcr.io/astral-sh/uv:python3.12
image: ghcr.io/astral-sh/uv:python3.13
variables:
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
cache:
@ -39,7 +39,7 @@ pytest:
script:
- docker compose -f docker-compose.local.yml run django pytest
{%- else %}
image: ghcr.io/astral-sh/uv:python3.12
image: ghcr.io/astral-sh/uv:python3.13
services:
- postgres:{{ cookiecutter.postgresql_version }}
variables:

View File

@ -3,7 +3,7 @@ default_stages: [pre-commit]
minimum_pre_commit_version: "3.2.0"
default_language_version:
python: python3.12
python: python3.13
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks

View File

@ -1 +1 @@
3.12
3.13

View File

@ -8,7 +8,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: '3.12'
python: '3.13'
# Build documentation in the docs/ directory with Sphinx
sphinx:

View File

@ -2,7 +2,7 @@ dist: focal
language: python
python:
- "3.12"
- "3.13"
services:
- {% if cookiecutter.use_docker == 'y' %}docker{% else %}postgresql{% endif %}
@ -38,7 +38,7 @@ jobs:
- sudo apt-get install -qq libsqlite3-dev libxml2 libxml2-dev libssl-dev libbz2-dev wget curl llvm
language: python
python:
- "3.12"
- "3.13"
install:
- pip install uv
- uv sync

View File

@ -1,5 +1,5 @@
# define an alias for the specific python version used in this file.
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS python
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim AS python
# Python build stage
FROM python AS python-build-stage
@ -44,7 +44,7 @@ RUN groupadd --gid 1000 dev-user \
&& chmod 0440 /etc/sudoers.d/dev-user
ENV PATH="/${APP_HOME}/.venv/bin:$PATH"
ENV PYTHONPATH="${APP_HOME}/.venv/lib/python3.12/site-packages:$PYTHONPATH"
ENV PYTHONPATH="${APP_HOME}/.venv/lib/python3.13/site-packages:$PYTHONPATH"
COPY ./compose/production/django/entrypoint /entrypoint
RUN sed -i 's/\r$//g' /entrypoint

View File

@ -1,5 +1,5 @@
# define an alias for the specific python version used in this file.
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS python
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim AS python
# Python build stage

View File

@ -1,4 +1,4 @@
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS python
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim AS python
ARG APP_HOME=/app

View File

@ -24,7 +24,7 @@ ENV DJANGO_AZURE_ACCOUNT_NAME=${DJANGO_AZURE_ACCOUNT_NAME}
RUN npm run build
{%- endif %}
# define an alias for the specific python version used in this file.
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS python-build-stage
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim AS python-build-stage
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy UV_PYTHON_DOWNLOADS=0
@ -57,7 +57,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked --no-dev
# Python 'run' stage
FROM python:3.12-slim-bookworm AS python-run-stage
FROM python:3.13-slim-bookworm AS python-run-stage
ARG APP_HOME=/app

View File

@ -65,7 +65,7 @@ MIDDLEWARE += ["debug_toolbar.middleware.DebugToolbarMiddleware"]
DEBUG_TOOLBAR_CONFIG = {
"DISABLE_PANELS": [
"debug_toolbar.panels.redirects.RedirectsPanel",
# Disable profiling panel due to an issue with Python 3.12:
# Disable profiling panel due to an issue with Python 3.12+:
# https://github.com/jazzband/django-debug-toolbar/issues/1875
"debug_toolbar.panels.profiling.ProfilingPanel",
],

View File

@ -18,7 +18,7 @@ plugins = ["django_coverage_plugin"]
# ==== mypy ====
[tool.mypy]
python_version = "3.12"
python_version = "3.13"
check_untyped_defs = true
ignore_missing_imports = true
warn_unused_ignores = true
@ -59,7 +59,6 @@ indent_size = 2
indent_size = 2
[tool.ruff]
target-version = "py312"
# Exclude a variety of commonly ignored directories.
extend-exclude = [
"*/migrations/*.py",
@ -148,5 +147,5 @@ license = { text = "{{ cookiecutter.open_source_license }}" }
authors = [
{ name = "{{ cookiecutter.author_name }}", email = "{{ cookiecutter.email }}" },
]
requires-python = "==3.12.*"
requires-python = "==3.13.*"
dependencies = []

View File

@ -1,2 +1,2 @@
version = 1
requires-python = "==3.12.*"
requires-python = "==3.13.*"