Skip to content

Commit

Permalink
Refs #36005 -- Bumped minimum supported versions of 3rd-party packages.
Browse files Browse the repository at this point in the history
This bumps minimum supported versions of 3rd-party packages to the first
releases to support Python 3.12.
  • Loading branch information
felixxm authored Jan 28, 2025
1 parent 8eca407 commit d9af197
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 47 deletions.
10 changes: 2 additions & 8 deletions django/db/backends/mysql/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
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__
)


Expand Down Expand Up @@ -254,12 +254,6 @@ def get_connection_params(self):
@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):
Expand Down
10 changes: 5 additions & 5 deletions django/db/backends/postgresql/base.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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__}"
)


Expand Down
22 changes: 11 additions & 11 deletions docs/internals/contributing/writing-code/unit-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions docs/ref/databases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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::

Expand Down Expand Up @@ -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
~~~~~~~~~~~~~~~~~~~~~~
Expand Down
22 changes: 22 additions & 0 deletions docs/releases/6.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------------

Expand Down
2 changes: 1 addition & 1 deletion docs/topics/email.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/topics/testing/tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/requirements/mysql.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mysqlclient >= 1.4.3
mysqlclient >= 2.2.1
3 changes: 1 addition & 2 deletions tests/requirements/postgres.txt
Original file line number Diff line number Diff line change
@@ -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
24 changes: 12 additions & 12 deletions tests/requirements/py3.txt
Original file line number Diff line number Diff line change
@@ -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'

0 comments on commit d9af197

Please sign in to comment.