diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py
index eb0e361d8d..e594067b50 100644
--- a/django/db/backends/mysql/base.py
+++ b/django/db/backends/mysql/base.py
@@ -32,9 +32,9 @@ from .schema import DatabaseSchemaEditor
from .validation import DatabaseValidation
version = Database.version_info
-if version < (1, 4, 3):
+if version < (2, 2, 1):
raise ImproperlyConfigured(
- "mysqlclient 1.4.3 or newer is required; you have %s." % Database.__version__
+ "mysqlclient 2.2.1 or newer is required; you have %s." % Database.__version__
)
@@ -254,12 +254,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
@async_unsafe
def get_new_connection(self, conn_params):
connection = Database.connect(**conn_params)
- # bytes encoder in mysqlclient doesn't work and was added only to
- # prevent KeyErrors in Django < 2.0. We can remove this workaround when
- # mysqlclient 2.1 becomes the minimal mysqlclient supported by Django.
- # See https://github.com/PyMySQL/mysqlclient/issues/489
- if connection.encoders.get(bytes) is bytes:
- connection.encoders.pop(bytes)
return connection
def init_connection_state(self):
diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py
index c864cab57a..a0b5e4154e 100644
--- a/django/db/backends/postgresql/base.py
+++ b/django/db/backends/postgresql/base.py
@@ -1,7 +1,7 @@
"""
PostgreSQL database backend for Django.
-Requires psycopg2 >= 2.8.4 or psycopg >= 3.1.8
+Requires psycopg2 >= 2.9.9 or psycopg >= 3.1.12
"""
import asyncio
@@ -34,13 +34,13 @@ def psycopg_version():
return get_version_tuple(version)
-if psycopg_version() < (2, 8, 4):
+if psycopg_version() < (2, 9, 9):
raise ImproperlyConfigured(
- f"psycopg2 version 2.8.4 or newer is required; you have {Database.__version__}"
+ f"psycopg2 version 2.9.9 or newer is required; you have {Database.__version__}"
)
-if (3,) <= psycopg_version() < (3, 1, 8):
+if (3,) <= psycopg_version() < (3, 1, 12):
raise ImproperlyConfigured(
- f"psycopg version 3.1.8 or newer is required; you have {Database.__version__}"
+ f"psycopg version 3.1.12 or newer is required; you have {Database.__version__}"
)
diff --git a/docs/internals/contributing/writing-code/unit-tests.txt b/docs/internals/contributing/writing-code/unit-tests.txt
index f2cdd76a17..489b651c4b 100644
--- a/docs/internals/contributing/writing-code/unit-tests.txt
+++ b/docs/internals/contributing/writing-code/unit-tests.txt
@@ -306,27 +306,27 @@ Running all the tests
If you want to run the full suite of tests, you'll need to install a number of
dependencies:
-* :pypi:`aiosmtpd`
-* :pypi:`argon2-cffi` 19.2.0+
+* :pypi:`aiosmtpd` 1.4.5+
+* :pypi:`argon2-cffi` 23.1.0+
* :pypi:`asgiref` 3.8.1+ (required)
-* :pypi:`bcrypt`
+* :pypi:`bcrypt` 4.1.1+
* :pypi:`colorama` 0.4.6+
* :pypi:`docutils` 0.19+
-* :pypi:`geoip2`
+* :pypi:`geoip2` 4.8.0+
* :pypi:`Jinja2` 2.11+
-* :pypi:`numpy`
-* :pypi:`Pillow` 6.2.1+
-* :pypi:`PyYAML`
+* :pypi:`numpy` 1.26.0+
+* :pypi:`Pillow` 10.1.0+
+* :pypi:`PyYAML` 6.0.2+
* :pypi:`pywatchman`
-* :pypi:`redis` 3.4+
+* :pypi:`redis` 5.1.0+
* :pypi:`setuptools`
* :pypi:`pymemcache`, plus a `supported Python binding
`_
* `gettext `_
(:ref:`gettext_on_windows`)
-* :pypi:`selenium` 4.8.0+
-* :pypi:`sqlparse` 0.3.1+ (required)
-* :pypi:`tblib` 1.5.0+
+* :pypi:`selenium` 4.23.0+
+* :pypi:`sqlparse` 0.5.0+ (required)
+* :pypi:`tblib` 3.0.0+
You can find these dependencies in `pip requirements files
`_ inside the
diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt
index 217be19728..541f6e6b71 100644
--- a/docs/ref/databases.txt
+++ b/docs/ref/databases.txt
@@ -115,8 +115,8 @@ below for information on how to set up your database correctly.
PostgreSQL notes
================
-Django supports PostgreSQL 14 and higher. `psycopg`_ 3.1.8+ or `psycopg2`_
-2.8.4+ is required, though the latest `psycopg`_ 3.1.8+ is recommended.
+Django supports PostgreSQL 14 and higher. `psycopg`_ 3.1.12+ or `psycopg2`_
+2.9.9+ is required, though the latest `psycopg`_ 3.1.12+ is recommended.
.. note::
@@ -486,7 +486,7 @@ Connector/Python includes `its own`_.
mysqlclient
~~~~~~~~~~~
-Django requires `mysqlclient`_ 1.4.3 or later.
+Django requires `mysqlclient`_ 2.2.1 or later.
MySQL Connector/Python
~~~~~~~~~~~~~~~~~~~~~~
diff --git a/docs/releases/6.0.txt b/docs/releases/6.0.txt
index 9dabf7f666..0645441c61 100644
--- a/docs/releases/6.0.txt
+++ b/docs/releases/6.0.txt
@@ -235,6 +235,28 @@ backends.
* ...
+Dropped support for Python < 3.12
+---------------------------------
+
+Because Python 3.12 is now the minimum supported version for Django, any
+optional dependencies must also meet that requirement. The following versions
+of each library are the first to add or confirm compatibility with Python 3.12:
+
+* ``aiosmtpd`` 1.4.5
+* ``argon2-cffi`` 23.1.0
+* ``bcrypt`` 4.1.1
+* ``geoip2`` 4.8.0
+* ``Pillow`` 10.1.0
+* ``mysqlclient`` 2.2.1
+* ``numpy`` 1.26.0
+* ``PyYAML`` 6.0.2
+* ``psycopg`` 3.1.12
+* ``psycopg2`` 2.9.9
+* ``redis-py`` 5.1.0
+* ``selenium`` 4.23.0
+* ``sqlparse`` 0.5.0
+* ``tblib`` 3.0.0
+
Miscellaneous
-------------
diff --git a/docs/topics/email.txt b/docs/topics/email.txt
index 74468063b8..ae4d81ef4b 100644
--- a/docs/topics/email.txt
+++ b/docs/topics/email.txt
@@ -815,7 +815,7 @@ anything. The :pypi:`aiosmtpd` package provides a way to accomplish this:
.. code-block:: shell
- python -m pip install aiosmtpd
+ python -m pip install "aiosmtpd >= 1.4.5"
python -m aiosmtpd -n -l localhost:8025
diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt
index a03ad7da78..ce8e3fd821 100644
--- a/docs/topics/testing/tools.txt
+++ b/docs/topics/testing/tools.txt
@@ -1022,7 +1022,7 @@ First of all, you need to install the :pypi:`selenium` package:
.. console::
- $ python -m pip install "selenium >= 4.8.0"
+ $ python -m pip install "selenium >= 4.23.0"
Then, add a ``LiveServerTestCase``-based test to your app's tests module
(for example: ``myapp/tests.py``). For this example, we'll assume you're using
diff --git a/pyproject.toml b/pyproject.toml
index 540e64d951..f10d15d20d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -8,7 +8,7 @@ dynamic = ["version"]
requires-python = ">= 3.12"
dependencies = [
"asgiref>=3.8.1",
- "sqlparse>=0.3.1",
+ "sqlparse>=0.5.0",
"tzdata; sys_platform == 'win32'",
]
authors = [
@@ -37,8 +37,8 @@ classifiers = [
]
[project.optional-dependencies]
-argon2 = ["argon2-cffi>=19.1.0"]
-bcrypt = ["bcrypt"]
+argon2 = ["argon2-cffi>=23.1.0"]
+bcrypt = ["bcrypt>=4.1.1"]
[project.scripts]
django-admin = "django.core.management:execute_from_command_line"
diff --git a/tests/requirements/mysql.txt b/tests/requirements/mysql.txt
index 27be1d86cc..d2e68b04cb 100644
--- a/tests/requirements/mysql.txt
+++ b/tests/requirements/mysql.txt
@@ -1 +1 @@
-mysqlclient >= 1.4.3
+mysqlclient >= 2.2.1
diff --git a/tests/requirements/postgres.txt b/tests/requirements/postgres.txt
index 91f911080c..b000879b5c 100644
--- a/tests/requirements/postgres.txt
+++ b/tests/requirements/postgres.txt
@@ -1,3 +1,2 @@
-psycopg>=3.1.14; implementation_name == 'pypy'
-psycopg[binary]>=3.1.8; implementation_name != 'pypy'
+psycopg[binary]>=3.1.12
psycopg-pool>=3.2.0
diff --git a/tests/requirements/py3.txt b/tests/requirements/py3.txt
index f0e208a115..131d84b1a5 100644
--- a/tests/requirements/py3.txt
+++ b/tests/requirements/py3.txt
@@ -1,21 +1,21 @@
-aiosmtpd
+aiosmtpd >= 1.4.5
asgiref >= 3.8.1
-argon2-cffi >= 19.2.0
-bcrypt
-black
+argon2-cffi >= 23.1.0
+bcrypt >= 4.1.1
+black >= 2.4.10
docutils >= 0.19
-geoip2
+geoip2 >= 4.8.0
jinja2 >= 2.11.0
-numpy; python_version < '3.14'
-Pillow >= 6.2.1; sys.platform != 'win32' or python_version < '3.14'
+numpy >= 1.26.0; python_version < '3.14'
+Pillow >= 10.1.0; sys.platform != 'win32' or python_version < '3.14'
# pylibmc/libmemcached can't be built on Windows.
pylibmc; sys_platform != 'win32'
pymemcache >= 3.4.0
pywatchman; sys_platform != 'win32'
-PyYAML
-redis >= 3.4.0
-selenium >= 4.8.0
-sqlparse >= 0.3.1
-tblib >= 1.5.0
+PyYAML >= 6.0.2
+redis >= 5.1.0
+selenium >= 4.23.0
+sqlparse >= 0.5.0
+tblib >= 3.0.0
tzdata
colorama >= 0.4.6; sys_platform == 'win32'