Skip to content

Commit 1e3be63

Browse files
authored
chore(librarian): for generation, bump python runtime to 3.14.2; drop 3.13 (googleapis#15004)
This PR makes the following changes to the Python Librarian Generator image - bumps the runtime for 3.14 to 3.14.2 - drop 3.13 following googleapis/librarian#2945 which is now fixed
1 parent b7c6f7e commit 1e3be63

File tree

3 files changed

+14
-33
lines changed

3 files changed

+14
-33
lines changed

.generator/Dockerfile

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,25 @@ RUN apt-get update && \
4040
&& apt-get clean && \
4141
rm -rf /var/lib/apt/lists/*
4242

43-
# `make altinstall` is used to prevent replacing the system's default python binary.
43+
ENV PYTHON_VERSION=3.14
44+
4445
# The full Python version, including the minor version, is needed for download/install
45-
# TODO(https://github.com/googleapis/librarian/issues/2945): Remove `3.13` when the linked issue is resolved.
46-
RUN for PYTHON_VERSION_WITH_MINOR in 3.13.9 3.14.0; do \
47-
wget https://www.python.org/ftp/python/${PYTHON_VERSION_WITH_MINOR}/Python-${PYTHON_VERSION_WITH_MINOR}.tgz && \
46+
ENV PYTHON_VERSION_WITH_MINOR=3.14.2
47+
48+
# `make altinstall` is used to prevent replacing the system's default python binary.
49+
RUN wget https://www.python.org/ftp/python/${PYTHON_VERSION_WITH_MINOR}/Python-${PYTHON_VERSION_WITH_MINOR}.tgz && \
4850
tar -xvf Python-${PYTHON_VERSION_WITH_MINOR}.tgz && \
4951
cd Python-${PYTHON_VERSION_WITH_MINOR} && \
5052
./configure --enable-optimizations --prefix=/usr/local && \
5153
make -j$(nproc) && \
5254
make altinstall && \
5355
cd / && \
54-
rm -rf Python-${PYTHON_VERSION_WITH_MINOR}* \
55-
; done
56+
rm -rf Python-${PYTHON_VERSION_WITH_MINOR}*
57+
5658

57-
# Install pip for each python version
58-
# TODO(https://github.com/googleapis/librarian/issues/2945): Remove `3.13` when the linked issue is resolved.
59-
RUN for PYTHON_VERSION in 3.13 3.14; do \
60-
wget --no-check-certificate -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' && \
59+
RUN wget --no-check-certificate -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' && \
6160
python${PYTHON_VERSION} /tmp/get-pip.py && \
62-
rm /tmp/get-pip.py \
63-
; done
61+
rm /tmp/get-pip.py
6462

6563
# Download/extract protoc
6664
RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v25.3/protoc-25.3-linux-x86_64.zip
@@ -112,10 +110,6 @@ COPY --from=builder synthtool /synthtool
112110
COPY --from=builder /usr/local/bin/python${PYTHON_VERSION_DEFAULT} /usr/local/bin/
113111
COPY --from=builder /usr/local/lib/python${PYTHON_VERSION_DEFAULT} /usr/local/lib/python${PYTHON_VERSION_DEFAULT}
114112

115-
# TODO(https://github.com/googleapis/librarian/issues/2945): Remove `3.13` when the linked issue is resolved.
116-
COPY --from=builder /usr/local/bin/python3.13 /usr/local/bin
117-
COPY --from=builder /usr/local/lib/python3.13 /usr/local/lib/python3.13
118-
119113
# Set the working directory in the container.
120114
WORKDIR /app
121115

.generator/cli.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -995,16 +995,7 @@ def _run_nox_sessions(library_id: str, repo: str, is_mono_repo: bool):
995995
the config.yaml.
996996
is_mono_repo(bool): True if the current repository is a mono-repo.
997997
"""
998-
path_to_library = f"{repo}/packages/{library_id}" if is_mono_repo else repo
999-
_python_314_supported = Path(
1000-
f"{path_to_library}/testing/constraints-3.14.txt"
1001-
).exists()
1002-
1003-
if _python_314_supported:
1004-
session_runtime = "3.14"
1005-
else:
1006-
session_runtime = "3.13"
1007-
998+
session_runtime = "3.14"
1008999
sessions = [
10091000
f"unit-{session_runtime}(protobuf_implementation='upb')",
10101001
]

.generator/test_cli.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -776,26 +776,22 @@ def test_run_individual_session_failure(mocker):
776776

777777

778778
@pytest.mark.parametrize(
779-
"is_mono_repo,py314_constraints_file_exists, nox_session_python_runtime",
779+
"is_mono_repo, nox_session_python_runtime",
780780
[
781-
(False, True, "3.14"),
782-
(True, True, "3.14"),
783-
(True, False, "3.13"),
784-
(False, False, "3.13"),
781+
(False, "3.14"),
782+
(True, "3.14"),
785783
],
786784
)
787785
def test_run_nox_sessions_success(
788786
mocker,
789787
mock_generate_request_data_for_nox,
790788
is_mono_repo,
791-
py314_constraints_file_exists,
792789
nox_session_python_runtime,
793790
):
794791
"""Tests that _run_nox_sessions successfully runs all specified sessions."""
795792
mocker.patch("cli._read_json_file", return_value=mock_generate_request_data_for_nox)
796793
mocker.patch("cli._get_library_id", return_value="mock-library")
797794
mock_run_individual_session = mocker.patch("cli._run_individual_session")
798-
mocker.patch("pathlib.Path.exists", return_value=py314_constraints_file_exists)
799795

800796
sessions_to_run = [
801797
f"unit-{nox_session_python_runtime}(protobuf_implementation='upb')",

0 commit comments

Comments
 (0)