From a86e6507490a250219fce32d5b3fdf2a8bc3ffb5 Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Fri, 14 Nov 2025 14:48:19 +0100 Subject: [PATCH 1/4] Remove Django 5.0 to save some CI resources --- docs/changes.rst | 3 ++- pyproject.toml | 1 - tox.ini | 13 ++++++------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/changes.rst b/docs/changes.rst index 372837ab1..705611c82 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -7,7 +7,8 @@ Pending * Deprecated ``RedirectsPanel`` in favor of ``HistoryPanel`` for viewing toolbar data from redirected requests. * Fixed support for generating code coverage comments in PRs. -* Added Django 6.0 to the testing matrix. +* Added Django 6.0 to the testing matrix. Removed Django 5.0 to save CI + resources. * Show the cache backend alias and cache backend class name instead of the cache instance in the cache panel. diff --git a/pyproject.toml b/pyproject.toml index 527aa79cb..28e921337 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,6 @@ classifiers = [ "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 4.2", - "Framework :: Django :: 5.0", "Framework :: Django :: 5.1", "Framework :: Django :: 5.2", "Intended Audience :: Developers", diff --git a/tox.ini b/tox.ini index 361fd9abd..c885f87a1 100644 --- a/tox.ini +++ b/tox.ini @@ -4,15 +4,14 @@ envlist = docs packaging py{39,310,311,312}-dj{42}-{sqlite,postgresql,postgis,mysql} - py{310,311}-dj{42,50,51,52}-{sqlite,postgresql,psycopg3,postgis,mysql} - py{312}-dj{42,50,51,52,60}-{sqlite,postgresql,psycopg3,postgis,mysql} + py{310,311}-dj{42,51,52}-{sqlite,postgresql,psycopg3,postgis,mysql} + py{312}-dj{42,51,52,60}-{sqlite,postgresql,psycopg3,postgis,mysql} py{313}-dj{51,52,60,main}-{sqlite,psycopg3,postgis3,mysql} py{314}-dj{52,60,main}-{sqlite,psycopg3,postgis3,mysql} [testenv] deps = dj42: django~=4.2.1 - dj50: django~=5.0.2 dj51: django~=5.1.0 dj52: django~=5.2.0a1 dj60: django~=6.0a1 @@ -56,28 +55,28 @@ pip_pre = True commands = python -b -W always -m coverage run -m django test -v2 {posargs:tests} -[testenv:py{39,310,311,312,313,314}-dj{42,50,51,52,60,main}-{postgresql,psycopg3}] +[testenv:py{39,310,311,312,313,314}-dj{42,51,52,60,main}-{postgresql,psycopg3}] setenv = {[testenv]setenv} DB_BACKEND = postgresql DB_PORT = {env:DB_PORT:5432} -[testenv:py{39,310,311,312,313,314}-dj{42,50,51,52,60,main}-{postgis,postgis3}] +[testenv:py{39,310,311,312,313,314}-dj{42,51,52,60,main}-{postgis,postgis3}] setenv = {[testenv]setenv} DB_BACKEND = postgis DB_PORT = {env:DB_PORT:5432} -[testenv:py{39,310,311,312,313,314}-dj{42,50,51,52,60,main}-mysql] +[testenv:py{39,310,311,312,313,314}-dj{42,51,52,60,main}-mysql] setenv = {[testenv]setenv} DB_BACKEND = mysql DB_PORT = {env:DB_PORT:3306} -[testenv:py{39,310,311,312,313,314}-dj{42,50,51,52,60,main}-sqlite] +[testenv:py{39,310,311,312,313,314}-dj{42,51,52,60,main}-sqlite] setenv = {[testenv]setenv} DB_BACKEND = sqlite3 From ac066568c866e6f89b9e24f4d50916750ef5236a Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Fri, 14 Nov 2025 14:52:24 +0100 Subject: [PATCH 2/4] Remove support for Python 3.9, it's EOL --- .github/workflows/test.yml | 10 ++++------ debug_toolbar/_stubs.py | 4 ++-- debug_toolbar/middleware.py | 2 +- debug_toolbar/toolbar.py | 2 +- docs/changes.rst | 1 + pyproject.toml | 5 ++--- tests/base.py | 3 +-- tox.ini | 11 +++++------ 8 files changed, 17 insertions(+), 21 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f3605a420..f452a064a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ jobs: fail-fast: false max-parallel: 5 matrix: - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] services: mariadb: @@ -91,11 +91,9 @@ jobs: fail-fast: false max-parallel: 5 matrix: - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] database: [postgresql, postgis, psycopg3] exclude: - - python-version: '3.9' - database: psycopg3 - python-version: '3.13' database: postgis - python-version: '3.13' @@ -192,7 +190,7 @@ jobs: fail-fast: false max-parallel: 5 matrix: - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14'] + python-version: ['3.10', '3.11', '3.12', '3.13', '3.14'] steps: - uses: actions/checkout@v5 @@ -252,7 +250,7 @@ jobs: - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v6 with: - python-version: 3.9 + python-version: 3.10 - name: Get pip cache dir id: pip-cache diff --git a/debug_toolbar/_stubs.py b/debug_toolbar/_stubs.py index dee6280d0..07217f39d 100644 --- a/debug_toolbar/_stubs.py +++ b/debug_toolbar/_stubs.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Any, NamedTuple, Optional, Protocol +from typing import Any, NamedTuple, Protocol from django import template as dj_template from django.http import HttpRequest, HttpResponse @@ -15,7 +15,7 @@ class InspectStack(NamedTuple): index: int -TidyStackTrace = list[tuple[str, int, str, str, Optional[Any]]] +TidyStackTrace = list[tuple[str, int, str, str, Any | None]] class RenderContext(dj_template.context.RenderContext): diff --git a/debug_toolbar/middleware.py b/debug_toolbar/middleware.py index 22d345a3f..862a38f9e 100644 --- a/debug_toolbar/middleware.py +++ b/debug_toolbar/middleware.py @@ -4,8 +4,8 @@ import re import socket +from collections.abc import Callable from functools import cache -from typing import Callable from asgiref.sync import ( async_to_sync, diff --git a/debug_toolbar/toolbar.py b/debug_toolbar/toolbar.py index 929ce7b70..ec0472790 100644 --- a/debug_toolbar/toolbar.py +++ b/debug_toolbar/toolbar.py @@ -7,8 +7,8 @@ import logging import re import uuid +from collections.abc import Callable from functools import cache -from typing import Callable from django.apps import apps from django.conf import settings diff --git a/docs/changes.rst b/docs/changes.rst index 705611c82..4cfa9e7ca 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -11,6 +11,7 @@ Pending resources. * Show the cache backend alias and cache backend class name instead of the cache instance in the cache panel. +* Dropped support for the Python 3.9, it has reached its end of life date. 6.1.0 (2025-10-30) ------------------ diff --git a/pyproject.toml b/pyproject.toml index 28e921337..53bc9bcc5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ license = { text = "BSD-3-Clause" } authors = [ { name = "Rob Hudson" }, ] -requires-python = ">=3.9" +requires-python = ">=3.10" classifiers = [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", @@ -25,7 +25,6 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -57,7 +56,7 @@ packages = [ path = "debug_toolbar/__init__.py" [tool.ruff] -target-version = "py39" +target-version = "py310" fix = true show-fixes = true diff --git a/tests/base.py b/tests/base.py index c18d3d1ed..152bc32e1 100644 --- a/tests/base.py +++ b/tests/base.py @@ -1,5 +1,4 @@ import contextvars -from typing import Optional import html5lib from asgiref.local import Local @@ -70,7 +69,7 @@ class BaseMixin: client_class = ToolbarTestClient async_client_class = AsyncToolbarTestClient - panel: Optional[Panel] = None + panel: Panel | None = None panel_id = None def setUp(self): diff --git a/tox.ini b/tox.ini index c885f87a1..4d50661cb 100644 --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,7 @@ isolated_build = true envlist = docs packaging - py{39,310,311,312}-dj{42}-{sqlite,postgresql,postgis,mysql} + py{310,311,312}-dj{42}-{sqlite,postgresql,postgis,mysql} py{310,311}-dj{42,51,52}-{sqlite,postgresql,psycopg3,postgis,mysql} py{312}-dj{42,51,52,60}-{sqlite,postgresql,psycopg3,postgis,mysql} py{313}-dj{51,52,60,main}-{sqlite,psycopg3,postgis3,mysql} @@ -55,28 +55,28 @@ pip_pre = True commands = python -b -W always -m coverage run -m django test -v2 {posargs:tests} -[testenv:py{39,310,311,312,313,314}-dj{42,51,52,60,main}-{postgresql,psycopg3}] +[testenv:py{310,311,312,313,314}-dj{42,51,52,60,main}-{postgresql,psycopg3}] setenv = {[testenv]setenv} DB_BACKEND = postgresql DB_PORT = {env:DB_PORT:5432} -[testenv:py{39,310,311,312,313,314}-dj{42,51,52,60,main}-{postgis,postgis3}] +[testenv:py{310,311,312,313,314}-dj{42,51,52,60,main}-{postgis,postgis3}] setenv = {[testenv]setenv} DB_BACKEND = postgis DB_PORT = {env:DB_PORT:5432} -[testenv:py{39,310,311,312,313,314}-dj{42,51,52,60,main}-mysql] +[testenv:py{310,311,312,313,314}-dj{42,51,52,60,main}-mysql] setenv = {[testenv]setenv} DB_BACKEND = mysql DB_PORT = {env:DB_PORT:3306} -[testenv:py{39,310,311,312,313,314}-dj{42,51,52,60,main}-sqlite] +[testenv:py{310,311,312,313,314}-dj{42,51,52,60,main}-sqlite] setenv = {[testenv]setenv} DB_BACKEND = sqlite3 @@ -101,7 +101,6 @@ skip_install = true [gh-actions] python = - 3.9: py39 3.10: py310 3.11: py311 3.12: py312 From 63eeea842067ce8cb8ac05eb9c5bf6c96280f4a2 Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Fri, 14 Nov 2025 14:54:09 +0100 Subject: [PATCH 3/4] Properly quote the Python version --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f452a064a..8b3c6301d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -250,7 +250,7 @@ jobs: - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v6 with: - python-version: 3.10 + python-version: '3.10' - name: Get pip cache dir id: pip-cache From d1609be7f5e344767be06d84d447e4168c138fab Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Fri, 14 Nov 2025 15:41:55 +0100 Subject: [PATCH 4/4] Update tox.ini Co-authored-by: Tim Schilling --- tox.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/tox.ini b/tox.ini index 4d50661cb..e7058e0fd 100644 --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,6 @@ isolated_build = true envlist = docs packaging - py{310,311,312}-dj{42}-{sqlite,postgresql,postgis,mysql} py{310,311}-dj{42,51,52}-{sqlite,postgresql,psycopg3,postgis,mysql} py{312}-dj{42,51,52,60}-{sqlite,postgresql,psycopg3,postgis,mysql} py{313}-dj{51,52,60,main}-{sqlite,psycopg3,postgis3,mysql}