Skip to content

Commit 15a85fb

Browse files
kbukum1Mark Allen
authored andcommitted
Upgrade Python versions and deprecate Python 3.9 (#15058)
* Update Python versions in Dockerfile and language.rb; adjust requirements.txt and language_spec.rb for deprecation of Python 3.9 * Add support for Python 3.9 by introducing requirements-3.9.txt and updating build script * Update comment for version specification in language.rb * Update comment in requirements-3.9.txt to clarify tomli dependency for Python <3.11 * Add deprecation notice for Python 3.9 in language.rb * Clarify deprecation notice for Python 3.9 in language.rb * Update pipenv version in requirements.txt to 2024.4.1
1 parent cfb2ac1 commit 15a85fb

6 files changed

Lines changed: 49 additions & 21 deletions

File tree

python/Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
# python/lib/dependabot/python/language.rb: PRE_INSTALLED_PYTHON_VERSIONS_RAW
44
# python/spec/dependabot/python/file_fetcher_spec.rb: exposes the expected ecosystem_versions metric spec
55
# Python versions are pinned to the release of each minor/patch version.
6-
ARG PY_3_14=3.14.2
7-
ARG PY_3_13=3.13.11
8-
ARG PY_3_12=3.12.12
9-
ARG PY_3_11=3.11.14
10-
ARG PY_3_10=3.10.19
11-
ARG PY_3_9=3.9.24
6+
ARG PY_3_14=3.14.5
7+
ARG PY_3_13=3.13.13
8+
ARG PY_3_12=3.12.13
9+
ARG PY_3_11=3.11.15
10+
ARG PY_3_10=3.10.20
11+
ARG PY_3_9=3.9.25
1212
# https://github.com/pyenv/pyenv/releases
1313
ARG PYENV_VERSION=v2.6.16
1414

python/helpers/build

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,25 @@ cp -r \
1515
"$helpers_dir/lib" \
1616
"$helpers_dir/run.py" \
1717
"$helpers_dir/requirements.txt" \
18+
"$helpers_dir/requirements-3.9.txt" \
1819
"$install_dir"
1920

2021
if [ -d "$helpers_dir/test" ]; then
2122
cp -r "$helpers_dir/test" "$install_dir"
2223
fi
2324

2425
cd "$install_dir"
25-
PYENV_VERSION=$1 pyenv exec pip3 --disable-pip-version-check install --use-pep517 -r "requirements.txt"
26+
27+
python_version=$1
28+
# pip 26.x and several other packages require Python >=3.10.
29+
# Use 3.9-compatible versions for the deprecated Python 3.9 runtime.
30+
if [[ "$python_version" == 3.9.* ]]; then
31+
req_file="requirements-3.9.txt"
32+
else
33+
req_file="requirements.txt"
34+
fi
35+
36+
PYENV_VERSION=$python_version pyenv exec pip3 --disable-pip-version-check install --use-pep517 -r "$req_file"
2637

2738
# Remove the extra objects added during the previous install. Based on
2839
# https://github.com/docker-library/python/blob/master/Dockerfile-linux.template
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Python 3.9-compatible versions pinned to the last known working set before
2+
# packages dropped 3.9 support. Python 3.9 reached end-of-life on 2025-10-31.
3+
pip==24.2
4+
pip-tools==7.5.3
5+
flake8==7.3.0
6+
hashin==1.0.5
7+
pipenv==2024.4.1
8+
plette==2.1.0
9+
poetry==2.2.1
10+
pytest==8.3.5
11+
# tomli is required for Python <3.11 (stdlib tomllib was added in 3.11).
12+
tomli==2.2.1
13+
14+
# Some dependencies will only install if Cython is present
15+
Cython==3.2.4

python/helpers/requirements.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
pip==24.2
1+
pip==26.1.1
22
pip-tools==7.5.3
33
flake8==7.3.0
44
hashin==1.0.5
55
pipenv==2024.4.1
6-
plette==2.1.0
7-
poetry==2.2.1
8-
pytest==8.3.5
6+
plette==2.2.1
7+
poetry==2.4.1
8+
pytest==9.0.3
99
# TODO: Replace 3p package `tomli` with 3.11's new stdlib `tomllib` once we drop support for Python 3.10.
10-
tomli==2.2.1
10+
tomli==2.4.1
1111

1212
# Some dependencies will only install if Cython is present
1313
Cython==3.2.4

python/lib/dependabot/python/language.rb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ class Language < Dependabot::Ecosystem::VersionManager
1313
extend T::Sig
1414

1515
# This list must match the versions specified at the top of `python/Dockerfile`
16-
# ARG PY_3_13=3.13.2
16+
# e.g. ARG PY_3_13=3.13.x
1717
# Note: uv ecosystem aliases this class, so updates here apply to both ecosystems.
1818
PRE_INSTALLED_PYTHON_VERSIONS_RAW = %w(
19-
3.14.2
20-
3.13.11
21-
3.12.12
22-
3.11.14
23-
3.10.19
24-
3.9.24
19+
3.14.5
20+
3.13.13
21+
3.12.13
22+
3.11.15
23+
3.10.20
24+
3.9.25
2525
).freeze
2626

2727
PRE_INSTALLED_PYTHON_VERSIONS = T.let(
@@ -47,7 +47,9 @@ class Language < Dependabot::Ecosystem::VersionManager
4747
T::Array[Dependabot::Python::Version]
4848
)
4949

50-
NON_SUPPORTED_HIGHEST_VERSION = "3.8"
50+
# The highest Python version that is no longer fully supported.
51+
# Deprecated now (warning); unsupported once removed from PRE_INSTALLED_PYTHON_VERSIONS_RAW.
52+
NON_SUPPORTED_HIGHEST_VERSION = "3.9"
5153

5254
DEPRECATED_VERSIONS = T.let([Version.new(NON_SUPPORTED_HIGHEST_VERSION)].freeze, T::Array[Dependabot::Version])
5355

python/spec/dependabot/python/language_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
end
2323

2424
context "when detected version is deprecated but not unsupported" do
25-
let(:detected_version) { "3.8.1" }
25+
let(:detected_version) { "3.9.1" }
2626

2727
before do
2828
allow(language).to receive(:unsupported?).and_return(false)

0 commit comments

Comments
 (0)