Skip to content

Commit 60c4851

Browse files
authored
Merge pull request #13321 from yeikel/python-3.14
Add support for Python 3.14
2 parents c4465e3 + 3229d47 commit 60c4851

7 files changed

Lines changed: 58 additions & 11 deletions

File tree

‎python/Dockerfile‎

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
# This list must match the versions specified in
22
# python/lib/dependabot/python/language.rb: PRE_INSTALLED_PYTHON_VERSIONS_RAW
3+
# python/spec/dependabot/python/file_fetcher_spec.rb: exposes the expected ecosystem_versions metric spec
4+
# Python versions are pinned to the release of each minor/patch version.
5+
ARG PY_3_14=3.14.0
36
ARG PY_3_13=3.13.5
47
ARG PY_3_12=3.12.11
58
ARG PY_3_11=3.11.13
69
ARG PY_3_10=3.10.18
710
ARG PY_3_9=3.9.23
8-
ARG PYENV_VERSION=v2.5.2
11+
# https://github.com/pyenv/pyenv/releases
12+
ARG PYENV_VERSION=v2.6.11
913

1014
FROM ghcr.io/dependabot/dependabot-updater-core AS python-core
15+
ARG PY_3_14
1116
ARG PY_3_13
1217
ARG PY_3_12
1318
ARG PY_3_11
@@ -122,6 +127,23 @@ RUN find $PYTHON_INSTALL_LOCATION/bin -type f -exec sed -i "1s|^#!/usr/local/bin
122127
# Ensure pyenv works and it's the python version we expect
123128
RUN PYENV_VERSION=$PY_3_13 pyenv exec python --version | grep "Python $PY_3_13" || exit 1
124129
RUN bash /opt/python/helpers/build $PY_3_13
130+
RUN cd $PYENV_ROOT/versions \
131+
&& tar -acf $PY_3_13.tar.zst $PY_3_13
132+
133+
## 3.14
134+
# Docker doesn't support parametrizing `COPY --from:python:$PY_1_23-bookworm`, so work around it using an alias.
135+
# TODO: If upstream adds support for Ubuntu, use that instead of Debian as the base suffix: https://github.com/docker-library/python/pull/791
136+
FROM docker.io/library/python:$PY_3_14-bookworm AS upstream-python-3.14
137+
FROM python-core AS python-3.14
138+
ARG PYTHON_INSTALL_LOCATION="$PYENV_ROOT/versions/$PY_3_14"
139+
COPY --from=upstream-python-3.14 --chown=dependabot:dependabot /usr/local/bin $PYTHON_INSTALL_LOCATION/bin
140+
COPY --from=upstream-python-3.14 --chown=dependabot:dependabot /usr/local/include $PYTHON_INSTALL_LOCATION/include
141+
COPY --from=upstream-python-3.14 --chown=dependabot:dependabot /usr/local/lib $PYTHON_INSTALL_LOCATION/lib
142+
# `pip` and other scripts need their shebangs rewritten for the new location
143+
RUN find $PYTHON_INSTALL_LOCATION/bin -type f -exec sed -i "1s|^#!/usr/local/bin/python|#!${PYTHON_INSTALL_LOCATION}/bin/python|" {} +
144+
# Ensure pyenv works and it's the python version we expect
145+
RUN PYENV_VERSION=$PY_3_14 pyenv exec python --version | grep "Python $PY_3_14" || exit 1
146+
RUN bash /opt/python/helpers/build $PY_3_14
125147
# This is the default Python, so no need to tar it
126148

127149
FROM python-core
@@ -154,12 +176,13 @@ COPY --from=python-3.9 $PYENV_ROOT/versions/$PY_3_9.tar.zst $PYENV_ROOT/versions
154176
COPY --from=python-3.10 $PYENV_ROOT/versions/$PY_3_10.tar.zst $PYENV_ROOT/versions/$PY_3_10.tar.zst
155177
COPY --from=python-3.11 $PYENV_ROOT/versions/$PY_3_11.tar.zst $PYENV_ROOT/versions/$PY_3_11.tar.zst
156178
COPY --from=python-3.12 $PYENV_ROOT/versions/$PY_3_12.tar.zst $PYENV_ROOT/versions/$PY_3_12.tar.zst
157-
COPY --from=python-3.13 $PYENV_ROOT/versions/ $PYENV_ROOT/versions/
179+
COPY --from=python-3.13 $PYENV_ROOT/versions/$PY_3_13.tar.zst $PYENV_ROOT/versions/$PY_3_13.tar.zst
180+
COPY --from=python-3.14 $PYENV_ROOT/versions/ $PYENV_ROOT/versions/
158181

159182
# Copy the output of the build script, it should be identical across Python versions
160-
COPY --from=python-3.13 /opt/python/ /opt/python/
183+
COPY --from=python-3.14 /opt/python/ /opt/python/
161184

162-
RUN pyenv global $PY_3_13
185+
RUN pyenv global $PY_3_14
163186

164187
USER root
165188

‎python/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Updating the list of known versions might be tricky, here are the steps:
1313
3. Update the list of known Python versions in [`language_version_manager.rb`](https://github.com/dependabot/dependabot-core/blob/main/python/lib/dependabot/python/language_version_manager.rb).
1414
4. Fix any broken tests.
1515

16-
[Example PR](https://github.com/dependabot/dependabot-core/pull/8732) that does all these things.
16+
[Example PR](https://github.com/dependabot/dependabot-core/pull/13321) that does all these things.
1717

1818
### Running locally
1919

‎python/lib/dependabot/python/language.rb‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class Language < Dependabot::Ecosystem::VersionManager
1616
# ARG PY_3_13=3.13.2
1717
# When updating this list, also update uv/lib/dependabot/uv/language.rb
1818
PRE_INSTALLED_PYTHON_VERSIONS_RAW = %w(
19+
3.14.0
1920
3.13.5
2021
3.12.11
2122
3.11.13

‎python/spec/dependabot/python/file_fetcher_spec.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@
528528
expect(file_fetcher_instance.ecosystem_versions).to eq(
529529
{
530530
# When there is no version specified, we assume the max supported
531-
languages: { python: { "max" => "3.13", "raw" => "unknown" } }
531+
languages: { python: { "max" => "3.14", "raw" => "unknown" } }
532532
}
533533
)
534534
end

‎uv/Dockerfile‎

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
# This list must match the versions specified in
22
# uv/lib/dependabot/uv/language.rb: PRE_INSTALLED_PYTHON_VERSIONS_RAW
33
# Python versions are pinned to the release of each minor/patch version.
4+
ARG PY_3_14=3.14.0
45
ARG PY_3_13=3.13.5
56
ARG PY_3_12=3.12.11
67
ARG PY_3_11=3.11.13
78
ARG PY_3_10=3.10.18
89
ARG PY_3_9=3.9.23
9-
ARG PYENV_VERSION=v2.5.2
10+
# https://github.com/pyenv/pyenv/releases
11+
ARG PYENV_VERSION=v2.6.11
12+
1013
# This cannot be inlined below (e.g., COPY --from=...) because Dependabot does not support that syntax yet
1114
FROM ghcr.io/astral-sh/uv:0.8.4 AS uv
1215

1316
FROM ghcr.io/dependabot/dependabot-updater-core AS python-core
17+
ARG PY_3_14
1418
ARG PY_3_13
1519
ARG PY_3_12
1620
ARG PY_3_11
@@ -123,6 +127,23 @@ RUN find $PYTHON_INSTALL_LOCATION/bin -type f -exec sed -i "1s|^#!/usr/local/bin
123127
# Ensure pyenv works and it's the python version we expect
124128
RUN PYENV_VERSION=$PY_3_13 pyenv exec python --version | grep "Python $PY_3_13" || exit 1
125129
RUN bash /opt/python/helpers/build $PY_3_13
130+
RUN cd $PYENV_ROOT/versions \
131+
&& tar -acf $PY_3_13.tar.zst $PY_3_13
132+
133+
## 3.14
134+
# Docker doesn't support parametrizing `COPY --from:python:$PY_1_23-bookworm`, so work around it using an alias.
135+
# TODO: If upstream adds support for Ubuntu, use that instead of Debian as the base suffix: https://github.com/docker-library/python/pull/791
136+
FROM docker.io/library/python:$PY_3_14-bookworm AS upstream-python-3.14
137+
FROM python-core AS python-3.14
138+
ARG PYTHON_INSTALL_LOCATION="$PYENV_ROOT/versions/$PY_3_14"
139+
COPY --from=upstream-python-3.14 --chown=dependabot:dependabot /usr/local/bin $PYTHON_INSTALL_LOCATION/bin
140+
COPY --from=upstream-python-3.14 --chown=dependabot:dependabot /usr/local/include $PYTHON_INSTALL_LOCATION/include
141+
COPY --from=upstream-python-3.14 --chown=dependabot:dependabot /usr/local/lib $PYTHON_INSTALL_LOCATION/lib
142+
# `pip` and other scripts need their shebangs rewritten for the new location
143+
RUN find $PYTHON_INSTALL_LOCATION/bin -type f -exec sed -i "1s|^#!/usr/local/bin/python|#!${PYTHON_INSTALL_LOCATION}/bin/python|" {} +
144+
# Ensure pyenv works and it's the python version we expect
145+
RUN PYENV_VERSION=$PY_3_14 pyenv exec python --version | grep "Python $PY_3_14" || exit 1
146+
RUN bash /opt/python/helpers/build $PY_3_14
126147
# This is the default Python, so no need to tar it
127148

128149
FROM python-core
@@ -155,12 +176,13 @@ COPY --from=python-3.9 $PYENV_ROOT/versions/$PY_3_9.tar.zst $PYENV_ROOT/versions
155176
COPY --from=python-3.10 $PYENV_ROOT/versions/$PY_3_10.tar.zst $PYENV_ROOT/versions/$PY_3_10.tar.zst
156177
COPY --from=python-3.11 $PYENV_ROOT/versions/$PY_3_11.tar.zst $PYENV_ROOT/versions/$PY_3_11.tar.zst
157178
COPY --from=python-3.12 $PYENV_ROOT/versions/$PY_3_12.tar.zst $PYENV_ROOT/versions/$PY_3_12.tar.zst
158-
COPY --from=python-3.13 $PYENV_ROOT/versions/ $PYENV_ROOT/versions/
179+
COPY --from=python-3.13 $PYENV_ROOT/versions/$PY_3_13.tar.zst $PYENV_ROOT/versions/$PY_3_13.tar.zst
180+
COPY --from=python-3.14 $PYENV_ROOT/versions/ $PYENV_ROOT/versions/
159181

160182
# Copy the output of the build script, it should be identical across Python versions
161-
COPY --from=python-3.13 /opt/python/ /opt/python/
183+
COPY --from=python-3.14 /opt/python/ /opt/python/
162184

163-
RUN pyenv global $PY_3_13
185+
RUN pyenv global $PY_3_14
164186

165187
USER root
166188

‎uv/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Updating the list of known versions might be tricky, here are the steps:
1313
3. Update the list of known Python versions in [`language_version_manager.rb`](https://github.com/dependabot/dependabot-core/blob/main/uv/lib/dependabot/uv/language_version_manager.rb).
1414
4. Fix any broken tests.
1515

16-
[Example PR](https://github.com/dependabot/dependabot-core/pull/8732) that does all these things for the `./python/` folder.
16+
[Example PR](https://github.com/dependabot/dependabot-core/pull/13321) that does all these things
1717

1818
### Running locally
1919

‎uv/lib/dependabot/uv/language.rb‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class Language < Dependabot::Ecosystem::VersionManager
1616
# ARG PY_3_13=3.13.2
1717
# When updating this list, also update python/lib/dependabot/python/language.rb
1818
PRE_INSTALLED_PYTHON_VERSIONS_RAW = %w(
19+
3.14.0
1920
3.13.5
2021
3.12.11
2122
3.11.13

0 commit comments

Comments
 (0)