-
Couldn't load subscription status.
- Fork 6.6k
feat: add Python 3.14 to samples testing image #13596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
parthea
wants to merge
5
commits into
main
Choose a base branch
from
add-python-314
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,43 +110,68 @@ RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ | |
| && rm -rf /var/lib/apt/lists/* \ | ||
| && rm -f /var/cache/apt/archives/*.deb | ||
|
|
||
| COPY fetch_gpg_keys.sh /tmp | ||
| # Install the desired versions of Python. | ||
| RUN set -ex \ | ||
| && export GNUPGHOME="$(mktemp -d)" \ | ||
| && echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \ | ||
| && /tmp/fetch_gpg_keys.sh \ | ||
| && PYTHON_VERSIONS="\ | ||
| 2.7.18 \ | ||
| 3.7.17 \ | ||
| 3.8.20 \ | ||
| 3.9.23 \ | ||
| 3.10.18 \ | ||
| 3.11.13 \ | ||
| 3.12.11 \ | ||
| 3.13.8 \ | ||
| 3.14.0" \ | ||
| && for VERSION in $PYTHON_VERSIONS; do \ | ||
| wget --no-check-certificate -O python-${VERSION}.tar.xz "https://www.python.org/ftp/python/${VERSION%%[a-z]*}/Python-$VERSION.tar.xz" \ | ||
| && wget --no-check-certificate -O python-${VERSION}.tar.xz.asc "https://www.python.org/ftp/python/${VERSION%%[a-z]*}/Python-$VERSION.tar.xz.asc" \ | ||
| && gpg --batch --verify python-${VERSION}.tar.xz.asc python-${VERSION}.tar.xz \ | ||
| && rm -r python-${VERSION}.tar.xz.asc \ | ||
| && mkdir -p /usr/src/python-${VERSION} \ | ||
| && tar -xJC /usr/src/python-${VERSION} --strip-components=1 -f python-${VERSION}.tar.xz \ | ||
| && rm python-${VERSION}.tar.xz \ | ||
| && cd /usr/src/python-${VERSION} \ | ||
| && ./configure \ | ||
| --enable-shared \ | ||
| # This works only on Python 2.7 and throws a warning on every other | ||
| # version, but seems otherwise harmless. | ||
| --enable-unicode=ucs4 \ | ||
| --with-system-ffi \ | ||
| --without-ensurepip \ | ||
| && make -j$(nproc) \ | ||
| && make install \ | ||
| && ldconfig \ | ||
| # From https://www.python.org/downloads/metadata/sigstore/ | ||
| # Starting with Python 3.14, Sigstore is the only method of signing and verification of release artifacts. | ||
| RUN LATEST_VERSION="2.6.1" && \ | ||
| wget "https://github.com/sigstore/cosign/releases/download/v${LATEST_VERSION}/cosign_${LATEST_VERSION}_amd64.deb" && \ | ||
| dpkg -i cosign_${LATEST_VERSION}_amd64.deb && \ | ||
| rm cosign_${LATEST_VERSION}_amd64.deb | ||
|
|
||
| ARG PYTHON_VERSIONS="3.7.17 3.8.20 3.9.23 3.10.18 3.11.13 3.12.11 3.13.8 3.14.0" | ||
|
|
||
| SHELL ["/bin/bash", "-c"] | ||
|
|
||
| RUN set -eux; \ | ||
| # Define the required associative arrays completely. | ||
| declare -A PYTHON_IDENTITIES; \ | ||
| PYTHON_IDENTITIES=(\ | ||
| [3.7]="[email protected]" \ | ||
| [3.8]="[email protected]" \ | ||
| [3.9]="[email protected]" \ | ||
| [3.10]="[email protected]" \ | ||
| [3.11]="[email protected]" \ | ||
| [3.12]="[email protected]" \ | ||
| [3.13]="[email protected]" \ | ||
| [3.14]="[email protected]" \ | ||
| ); \ | ||
| declare -A PYTHON_ISSUERS; \ | ||
| PYTHON_ISSUERS=(\ | ||
| [3.7]="https://github.com/login/oauth" \ | ||
| [3.8]="https://github.com/login/oauth" \ | ||
| [3.9]="https://github.com/login/oauth" \ | ||
| [3.10]="https://accounts.google.com" \ | ||
| [3.11]="https://accounts.google.com" \ | ||
| [3.12]="https://accounts.google.com" \ | ||
| [3.13]="https://accounts.google.com" \ | ||
| [3.14]="https://github.com/login/oauth" \ | ||
| ); \ | ||
| \ | ||
| for VERSION in $PYTHON_VERSIONS; do \ | ||
| # 1. Define VERSION_GROUP (e.g., 3.14 from 3.14.0) | ||
| VERSION_GROUP="$(echo "${VERSION}" | cut -d . -f 1,2)"; \ | ||
| \ | ||
| # 2. Look up IDENTITY and ISSUER using the defined VERSION_GROUP | ||
| IDENTITY="${PYTHON_IDENTITIES[$VERSION_GROUP]}"; \ | ||
| ISSUER="${PYTHON_ISSUERS[$VERSION_GROUP]}"; \ | ||
| \ | ||
| wget --quiet -O python-${VERSION}.tar.xz "https://www.python.org/ftp/python/${VERSION}/Python-$VERSION.tar.xz" \ | ||
| && wget --quiet -O python-${VERSION}.tar.xz.sigstore "https://www.python.org/ftp/python/${VERSION}/Python-$VERSION.tar.xz.sigstore" \ | ||
| # Verify the Python tarball signature with cosign. | ||
| && cosign verify-blob python-${VERSION}.tar.xz \ | ||
| --certificate-oidc-issuer "${ISSUER}" \ | ||
| --certificate-identity "${IDENTITY}" \ | ||
| --bundle python-${VERSION}.tar.xz.sigstore \ | ||
| && mkdir -p /usr/src/python-${VERSION} \ | ||
| && tar -xJC /usr/src/python-${VERSION} --strip-components=1 -f python-${VERSION}.tar.xz \ | ||
| && rm python-${VERSION}.tar.xz \ | ||
| && cd /usr/src/python-${VERSION} \ | ||
| && ./configure \ | ||
| --enable-shared \ | ||
| --with-system-ffi \ | ||
| && make -j$(nproc) \ | ||
| && make install \ | ||
| && ldconfig \ | ||
| ; done \ | ||
| && rm -rf "${GNUPGHOME}" \ | ||
| && rm -rf /usr/src/python* \ | ||
| && rm -rf ~/.cache/ | ||
|
|
||
|
|
@@ -168,6 +193,7 @@ RUN wget --no-check-certificate -O /tmp/get-pip-3-7.py 'https://bootstrap.pypa.i | |
| && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] | ||
|
|
||
| # Ensure Pip for all python3 versions | ||
| RUN python3.14 /tmp/get-pip.py | ||
| RUN python3.13 /tmp/get-pip.py | ||
| RUN python3.12 /tmp/get-pip.py | ||
| RUN python3.11 /tmp/get-pip.py | ||
|
|
@@ -185,6 +211,7 @@ RUN python3.10 -m pip | |
| RUN python3.11 -m pip | ||
| RUN python3.12 -m pip | ||
| RUN python3.13 -m pip | ||
| RUN python3.14 -m pip | ||
|
|
||
| # Install "setuptools" for Python 3.12+ (see https://docs.python.org/3/whatsnew/3.12.html#distutils) | ||
| RUN python3.12 -m pip install --no-cache-dir setuptools | ||
|
|
||
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit removes Python 2.7 entirely from the base image. Will this affect CI?
Per an earlier update, #13066 (comment) indicates this was going to be removed, but it's still an active check on this PR. I also recall an earlier PR (can't find it now) where removing Python 2.7 breaks kokoro. Was that resolved? I'm cautious of an update that adds a new python version but also coincidently removes an older major version.