Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ body:
attributes:
label: Python Version
description: Which version of Python were you using?
placeholder: 3.9.0
placeholder: 3.14.0
validations:
required: false
- type: input
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
fail-fast: false
matrix:
python-version:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
Expand Down
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Changelog
=========

* Drop Python 3.9 support.

4.19.0 (2025-09-18)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Installation
Requirements
------------

Python 3.9 to 3.14 supported.
Python 3.10 to 3.14 supported.

Django 4.2 to 6.0 supported.

Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ license-files = [ "LICENSE" ]
authors = [
{ name = "Adam Johnson", email = "me@adamj.eu" },
]
requires-python = ">=3.9"
requires-python = ">=3.10"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Framework :: Django",
Expand All @@ -32,7 +32,6 @@ classifiers = [
"Natural Language :: English",
"Operating System :: OS Independent",
"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",
Expand Down
3 changes: 2 additions & 1 deletion src/django_mysql/apps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

from typing import Any, Callable
from collections.abc import Callable
from typing import Any

from django.apps import AppConfig
from django.conf import settings
Expand Down
4 changes: 2 additions & 2 deletions src/django_mysql/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import pickle
import re
import zlib
from collections.abc import Iterable
from collections.abc import Callable, Iterable
from random import random
from time import time
from typing import Any, Callable, Literal, cast
from typing import Any, Literal, cast

from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache, default_key_func
from django.db import connections, router
Expand Down
38 changes: 17 additions & 21 deletions src/django_mysql/models/fields/dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import datetime as dt
import json
from collections.abc import Iterable
from typing import Any, Callable, Union, cast
from collections.abc import Callable, Iterable
from typing import Any, cast

from django.core import checks
from django.db.backends.base.base import BaseDatabaseWrapper
Expand Down Expand Up @@ -38,25 +38,21 @@
# define this type to two levels deep.
SpecDict = dict[
str,
Union[
type[dt.date],
type[dt.datetime],
type[float],
type[int],
type[str],
type[dt.time],
dict[
str,
Union[
type[dt.date],
type[dt.datetime],
type[float],
type[int],
type[str],
type[dt.time],
dict[str, Any],
],
],
type[dt.date]
| type[dt.datetime]
| type[float]
| type[int]
| type[str]
| type[dt.time]
| dict[
str,
type[dt.date]
| type[dt.datetime]
| type[float]
| type[int]
| type[str]
| type[dt.time]
| dict[str, Any],
],
]

Expand Down
4 changes: 2 additions & 2 deletions src/django_mysql/models/fields/lists.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from collections.abc import Iterable
from typing import Any, Callable, cast
from collections.abc import Callable, Iterable
from typing import Any, cast

from django.core import checks
from django.db.backends.base.base import BaseDatabaseWrapper
Expand Down
7 changes: 2 additions & 5 deletions src/django_mysql/models/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import datetime as dt
import json
from typing import Any, Union
from typing import Any, TypeAlias

from django.db import DEFAULT_DB_ALIAS, connections
from django.db.backends.base.base import BaseDatabaseWrapper
Expand All @@ -18,10 +18,7 @@
from django.db.models import Field as DjangoField
from django.db.models.sql.compiler import SQLCompiler

ExpressionArgument = Union[
Expression,
str, # column reference handled by Django
]
ExpressionArgument: TypeAlias = Expression | str


class SingleArgFunc(Func):
Expand Down
4 changes: 2 additions & 2 deletions src/django_mysql/models/lookups.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from collections.abc import Iterable
from typing import Any, Callable
from collections.abc import Callable, Iterable
from typing import Any

from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.models import CharField, Lookup, Transform
Expand Down
8 changes: 4 additions & 4 deletions src/django_mysql/models/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import subprocess
import sys
import time
from collections.abc import Generator
from collections.abc import Callable, Generator
from contextlib import nullcontext
from copy import copy
from functools import cache, wraps
from typing import Any, Callable, Literal, Optional, TypedDict, TypeVar, Union, cast
from typing import Any, Literal, TypedDict, TypeVar, cast

from django.conf import settings
from django.db import connections, models
Expand Down Expand Up @@ -36,9 +36,9 @@ class _CountTriesApproxDict(TypedDict):
min_size: int


_IndexHintForType = Optional[Literal["JOIN", "ORDER BY", "GROUP BY"]]
_IndexHintForType = Literal["JOIN", "ORDER BY", "GROUP BY", None]

_SmartPkRangeType = Union[None, tuple[int, int], Literal["all"]]
_SmartPkRangeType = None | tuple[int, int] | Literal["all"]
_SmartDirectionType = Literal[-1, 1]


Expand Down
4 changes: 2 additions & 2 deletions tests/testapp/test_locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def lock_until_told():
assert threading_test.is_held()
assert threading_test.holding_connection_id() != own_connection_id

with pytest.raises(TimeoutError), threading_test:
with pytest.raises(TimeoutError), threading_test: # pragma: no cover
pass

to_you.put("Stop")
Expand Down Expand Up @@ -161,7 +161,7 @@ def check_it_lock_it():
assert the_lock.is_held()
assert the_lock.holding_connection_id() != own_connection_id

with pytest.raises(TimeoutError), the_lock:
with pytest.raises(TimeoutError), the_lock: # pragma: no cover
pass

to_you.put("Stop")
Expand Down
8 changes: 1 addition & 7 deletions tests/testapp/utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from __future__ import annotations

import sys
from collections.abc import Generator
from contextlib import contextmanager
from types import TracebackType
from typing import Any
from typing import Any, TypeGuard

import pytest
from django.db import DEFAULT_DB_ALIAS, connection, connections
Expand All @@ -13,11 +12,6 @@
from django.db.backends.utils import CursorWrapper
from django.test.utils import CaptureQueriesContext

if sys.version_info >= (3, 10):
from typing import TypeGuard
else:
from typing_extensions import TypeGuard


def conn_is_mysql(connection: BaseDatabaseWrapper) -> TypeGuard[MySQLDatabaseWrapper]:
return connection.vendor == "mysql"
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ env_list =
py312-django{60, 52, 51, 50, 42}
py311-django{52, 51, 50, 42}
py310-django{52, 51, 50, 42}
py39-django{42}

[testenv]
runner = uv-venv-lock-runner
Expand Down
Loading