Skip to content

Commit

Permalink
Drop Django 3.2 to 4.1 support (#1118)
Browse files Browse the repository at this point in the history
These versions are all EOL since April.
  • Loading branch information
adamchainz authored Oct 29, 2024
1 parent a9e6ed6 commit d3ed6c6
Show file tree
Hide file tree
Showing 17 changed files with 39 additions and 1,499 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ repos:
rev: 1.21.0
hooks:
- id: django-upgrade
args: [--target-version, '3.2']
args: [--target-version, '4.2']
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.10.0
hooks:
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Changelog
=========

Unreleased
----------

* Drop Django 3.2 to 4.1 support.

* Drop Python 3.8 support.

* Support Python 3.13.
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Requirements

Python 3.9 to 3.13 supported.

Django 3.2 to 5.1 supported.
Django 4.2 to 5.1 supported.

Tested on MySQL 8.0+ and MariaDB 10.5+.

Expand Down
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ requires-python = ">=3.9"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
"Framework :: Django :: 4.1",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Framework :: Django :: 5.1",
Expand All @@ -42,7 +39,7 @@ classifiers = [
"Typing :: Typed",
]
dependencies = [
"django>=3.2",
"django>=4.2",
]
urls.Changelog = "https://django-mysql.readthedocs.io/en/latest/changelog.html"
urls.Documentation = "https://django-mysql.readthedocs.io/"
Expand Down
8 changes: 1 addition & 7 deletions src/django_mysql/models/fields/bit.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@ def db_type(self, connection: BaseDatabaseWrapper) -> str:
def from_db_value(
self, value: Any, expression: Expression, connection: BaseDatabaseWrapper
) -> Any:
# Meant to be binary/bytes but can come back as unicode strings
if isinstance(value, bytes):
value = value == b"\x01"
elif isinstance(value, str):
# Only on older versions of mysqlclient and Py 2.7
value = value == "\x01" # pragma: no cover
return value
return value == b"\x01"

def get_prep_value(self, value: Any) -> int | None:
if value is None:
Expand Down
4 changes: 1 addition & 3 deletions src/django_mysql/models/fields/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import Any
from typing import cast

import django
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.models import CharField
from django.utils.encoding import force_str
Expand All @@ -15,8 +14,7 @@
class EnumField(CharField):
description = _("Enumeration")

if django.VERSION >= (4, 1):
non_db_attrs = tuple(f for f in CharField.non_db_attrs if f != "choices")
non_db_attrs = tuple(f for f in CharField.non_db_attrs if f != "choices")

def __init__(
self,
Expand Down
70 changes: 0 additions & 70 deletions tests/requirements/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +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.9",
"--output-file",
"py39-django32.txt",
],
input=b"Django>=3.2a1,<3.3\nmysqlclient>=1.4.0\n",
)
run(
[
*common_args,
"--python",
"3.9",
"--output-file",
"py39-django40.txt",
],
input=b"Django>=4.0a1,<4.1\nmysqlclient>=1.4.0\n",
)
run(
[
*common_args,
"--python",
"3.9",
"--output-file",
"py39-django41.txt",
],
input=b"Django>=4.1a1,<4.2\nmysqlclient>=1.4.0\n",
)
run(
[
*common_args,
Expand All @@ -63,36 +33,6 @@
],
input=b"Django>=4.2a1,<5.0\nmysqlclient>=1.4.3\n",
)
run(
[
*common_args,
"--python",
"3.10",
"--output-file",
"py310-django32.txt",
],
input=b"Django>=3.2a1,<3.3\nmysqlclient>=1.4.0\n",
)
run(
[
*common_args,
"--python",
"3.10",
"--output-file",
"py310-django40.txt",
],
input=b"Django>=4.0a1,<4.1\nmysqlclient>=1.4.0\n",
)
run(
[
*common_args,
"--python",
"3.10",
"--output-file",
"py310-django41.txt",
],
input=b"Django>=4.1a1,<4.2\nmysqlclient>=1.4.0\n",
)
run(
[
*common_args,
Expand Down Expand Up @@ -123,16 +63,6 @@
],
input=b"Django>=5.1a1,<5.2\nmysqlclient>=1.4.3\n",
)
run(
[
*common_args,
"--python",
"3.11",
"--output-file",
"py311-django41.txt",
],
input=b"Django>=4.1a1,<4.2\nmysqlclient>=1.4.0\n",
)
run(
[
*common_args,
Expand Down
186 changes: 0 additions & 186 deletions tests/requirements/py310-django32.txt

This file was deleted.

Loading

0 comments on commit d3ed6c6

Please sign in to comment.