Browse Source

Refs #36005 -- Bumped minimum supported versions of 3rd-party packages.

This bumps minimum supported versions of 3rd-party packages to the first
releases to support Python 3.12.
Mariusz Felisiak 1 month ago
parent
commit
d9af197801

+ 2 - 8
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):

+ 5 - 5
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__}"
     )
 
 

+ 11 - 11
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
   <https://memcached.org/>`_
 * `gettext <https://www.gnu.org/software/gettext/manual/gettext.html>`_
   (: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
 <https://pip.pypa.io/en/latest/user_guide/#requirements-files>`_ inside the

+ 3 - 3
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
 ~~~~~~~~~~~~~~~~~~~~~~

+ 22 - 0
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
 -------------
 

+ 1 - 1
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
 

+ 1 - 1
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

+ 3 - 3
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"

+ 1 - 1
tests/requirements/mysql.txt

@@ -1 +1 @@
-mysqlclient >= 1.4.3
+mysqlclient >= 2.2.1

+ 1 - 2
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

+ 12 - 12
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'