Skip to content

Commit

Permalink
Drop Python 3.8 support (#1117)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz authored Oct 29, 2024
1 parent 0f6f0c6 commit 01f34f5
Show file tree
Hide file tree
Showing 24 changed files with 36 additions and 918 deletions.
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
fail-fast: false
matrix:
python-version:
- 3.8
- 3.9
- '3.10'
- '3.11'
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ repos:
rev: v3.17.0
hooks:
- id: pyupgrade
args: [--py38-plus]
args: [--py39-plus]
- repo: https://github.com/adamchainz/django-upgrade
rev: 1.21.0
hooks:
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.8 support.

* Support Python 3.13.

* Add testing for MariaDB 10.11 and 11.4, and MySQL 9.0.
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.8 to 3.13 supported.
Python 3.9 to 3.13 supported.

Django 3.2 to 5.1 supported.

Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ keywords = [
authors = [
{ name = "Adam Johnson", email = "[email protected]" },
]
requires-python = ">=3.8"
requires-python = ">=3.9"
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.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down
5 changes: 2 additions & 3 deletions src/django_mysql/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
import pickle
import re
import zlib
from collections.abc import Iterable
from random import random
from textwrap import dedent
from time import time
from typing import Any
from typing import Callable
from typing import Iterable
from typing import Literal
from typing import Tuple
from typing import cast

from django.core.cache.backends.base import DEFAULT_TIMEOUT
Expand Down Expand Up @@ -98,7 +97,7 @@ def get_reverse_key_func(
return reverse_key_func
else:
return cast(
Callable[[str], Tuple[str, str, int]],
Callable[[str], tuple[str, str, int]],
import_string(reverse_key_func),
)
return None
Expand Down
2 changes: 1 addition & 1 deletion src/django_mysql/checks.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
from typing import Iterable

from django.core import checks

Expand Down
17 changes: 0 additions & 17 deletions src/django_mysql/compat.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/django_mysql/models/expressions.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
from typing import Iterable

from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.models import F
Expand Down
34 changes: 16 additions & 18 deletions src/django_mysql/models/fields/dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

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

Expand Down Expand Up @@ -37,25 +35,25 @@

# Mypy doesn't support recursive types at time of writing, but we can at least
# define this type to two levels deep.
SpecDict = Dict[
SpecDict = dict[
str,
Union[
Type[dt.date],
Type[dt.datetime],
Type[float],
Type[int],
Type[str],
Type[dt.time],
Dict[
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, Any],
],
],
],
Expand Down
2 changes: 1 addition & 1 deletion src/django_mysql/models/fields/lists.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

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

from django.core import checks
Expand Down
2 changes: 1 addition & 1 deletion src/django_mysql/models/lookups.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

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

from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.models import CharField
Expand Down
7 changes: 3 additions & 4 deletions src/django_mysql/models/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
import subprocess
import sys
import time
from collections.abc import Generator
from contextlib import nullcontext
from copy import copy
from functools import cache
from functools import wraps
from typing import Any
from typing import Callable
from typing import Generator
from typing import Literal
from typing import Optional
from typing import Tuple
from typing import TypedDict
from typing import TypeVar
from typing import Union
Expand All @@ -26,7 +26,6 @@
from django.utils.functional import cached_property
from django.utils.translation import gettext as _

from django_mysql.compat import cache
from django_mysql.rewrite_query import REWRITE_MARKER
from django_mysql.status import GlobalStatus
from django_mysql.utils import StopWatch
Expand All @@ -46,7 +45,7 @@ class _CountTriesApproxDict(TypedDict):

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

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


Expand Down
2 changes: 1 addition & 1 deletion src/django_mysql/models/transforms.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
from typing import Iterable

from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.models import IntegerField
Expand Down
2 changes: 1 addition & 1 deletion src/django_mysql/status.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import time
from typing import Iterable
from collections.abc import Iterable

from django.db import connections
from django.db.backends.utils import CursorWrapper
Expand Down
6 changes: 2 additions & 4 deletions src/django_mysql/typing.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from __future__ import annotations

from collections.abc import Iterable
from typing import Any
from typing import Dict
from typing import Iterable
from typing import Tuple

DeconstructResult = Tuple[str, str, Iterable[Any], Dict[str, Any]]
DeconstructResult = tuple[str, str, Iterable[Any], dict[str, Any]]
2 changes: 1 addition & 1 deletion src/django_mysql/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import time
from collections import defaultdict
from collections.abc import Generator
from types import TracebackType
from typing import Any
from typing import Generator

from django.db import DEFAULT_DB_ALIAS
from django.db import connections
Expand Down
40 changes: 0 additions & 40 deletions tests/requirements/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,46 +23,6 @@
run = partial(subprocess.run, check=True)
# mysqlclient requirements found on each version's "Databases" documentation page:
# https://docs.djangoproject.com/en/3.0/ref/databases/#mysql-db-api-drivers
run(
[
*common_args,
"--python",
"3.8",
"--output-file",
"py38-django32.txt",
],
input=b"Django>=3.2a1,<3.3\nmysqlclient>=1.4.0\n",
)
run(
[
*common_args,
"--python",
"3.8",
"--output-file",
"py38-django40.txt",
],
input=b"Django>=4.0a1,<4.1\nmysqlclient>=1.4.0\n",
)
run(
[
*common_args,
"--python",
"3.8",
"--output-file",
"py38-django41.txt",
],
input=b"Django>=4.1a1,<4.2\nmysqlclient>=1.4.0\n",
)
run(
[
*common_args,
"--python",
"3.8",
"--output-file",
"py38-django42.txt",
],
input=b"Django>=4.2a1,<5.0\nmysqlclient>=1.4.3\n",
)
run(
[
*common_args,
Expand Down
Loading

0 comments on commit 01f34f5

Please sign in to comment.