Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 97c34cb

Browse files
authored
feat!: Bump minimum version to 3.10 (#334)
* feat!: Use Python3.10 as default version * test: update goldens * fix: update GH Workflows string * build: update Dockerfile * build: fix Dockerfile * test: update golden test data * build: fix Dockerfile * build: fix dockerfile * build: fix Dockerfile
1 parent 0c22d4f commit 97c34cb

23 files changed

Lines changed: 133 additions & 81 deletions

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: [3.9]
10+
python-version: ['3.10']
1111

1212
steps:
1313
- uses: actions/checkout@v3

.kokoro/docker/docs/Dockerfile

Lines changed: 27 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -52,58 +52,41 @@ RUN apt-get update \
5252
wget \
5353
zlib1g-dev \
5454
&& add-apt-repository universe \
55+
&& add-apt-repository ppa:deadsnakes/ppa \
5556
&& apt-get update \
5657
&& apt-get -y install jq \
5758
&& apt-get clean autoclean \
5859
&& apt-get autoremove -y \
60+
&& apt install -y python3.10-distutils \
5961
&& rm -rf /var/lib/apt/lists/* \
6062
&& rm -f /var/cache/apt/archives/*.deb
6163

62-
COPY fetch_gpg_keys.sh /tmp
63-
# Install the desired versions of Python.
64-
RUN set -ex \
65-
&& export GNUPGHOME="$(mktemp -d)" \
66-
&& echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \
67-
&& /tmp/fetch_gpg_keys.sh \
68-
&& for PYTHON_VERSION in 3.9.13; do \
69-
wget --no-check-certificate -O python-${PYTHON_VERSION}.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
70-
&& wget --no-check-certificate -O python-${PYTHON_VERSION}.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
71-
&& gpg --batch --verify python-${PYTHON_VERSION}.tar.xz.asc python-${PYTHON_VERSION}.tar.xz \
72-
&& rm -r python-${PYTHON_VERSION}.tar.xz.asc \
73-
&& mkdir -p /usr/src/python-${PYTHON_VERSION} \
74-
&& tar -xJC /usr/src/python-${PYTHON_VERSION} --strip-components=1 -f python-${PYTHON_VERSION}.tar.xz \
75-
&& rm python-${PYTHON_VERSION}.tar.xz \
76-
&& cd /usr/src/python-${PYTHON_VERSION} \
77-
&& ./configure \
78-
--enable-shared \
79-
# This works only on Python 2.7 and throws a warning on every other
80-
# version, but seems otherwise harmless.
81-
--enable-unicode=ucs4 \
82-
--with-system-ffi \
83-
--without-ensurepip \
84-
&& make -j$(nproc) \
85-
&& make install \
86-
&& ldconfig \
87-
; done \
88-
&& rm -rf "${GNUPGHOME}" \
89-
&& rm -rf /usr/src/python* \
90-
&& rm -rf ~/.cache/
91-
92-
# Install pip on Python 3.9 only.
93-
# If the environment variable is called "PIP_VERSION", pip explodes with
94-
# "ValueError: invalid truth value '<VERSION>'"
95-
ENV PYTHON_PIP_VERSION 23.0
96-
RUN wget --no-check-certificate -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
97-
&& python3.9 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \
98-
# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python
99-
# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.10/site-packages")
100-
# https://github.com/docker-library/python/pull/143#issuecomment-241032683
101-
&& pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
102-
# then we use "pip list" to ensure we don't have more than one pip version installed
103-
# https://github.com/docker-library/python/pull/100
104-
&& [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ]
105-
10664
# Install Google Cloud SDK
10765
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && apt-get update -y && apt-get install google-cloud-sdk -y
10866

67+
68+
###################### Install python 3.10.13
69+
70+
# Download python 3.10.13
71+
RUN wget https://www.python.org/ftp/python/3.10.13/Python-3.10.13.tgz
72+
73+
# Extract files
74+
RUN tar -xvf Python-3.10.13.tgz
75+
76+
# Install python 3.10.13
77+
RUN ./Python-3.10.13/configure --enable-optimizations
78+
RUN make altinstall
79+
80+
###################### Install pip
81+
RUN apt install -y python3-pip
82+
83+
# Test pip
84+
RUN python3.10 -m pip
85+
86+
# Make Python3.10 the default version
87+
RUN unlink /usr/bin/python3 && ln -s /usr/local/bin/python3.10 /usr/bin/python3
88+
89+
# Test version
90+
RUN python3 --version
91+
10992
CMD ["python3"]

docfx_yaml/extension.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@
4747
from sphinx.util import ensuredir
4848
from sphinx.errors import ExtensionError
4949
from sphinx.util.nodes import make_refnode
50-
from sphinxcontrib.napoleon.docstring import GoogleDocstring
51-
from sphinxcontrib.napoleon import Config, _process_docstring
50+
from sphinx.ext.napoleon import GoogleDocstring
51+
from sphinx.ext.napoleon import Config
52+
from sphinx.ext.napoleon import _process_docstring
5253

5354
from .utils import transform_node, transform_string
5455
from .settings import API_ROOT

requirements.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,3 @@ pytest
99
# Other dependencies
1010
black==22.10.0
1111
parameterized==0.8.1
12-
# google-resumable-media-python requires manual update as this repo isn't templated.
13-
# python-api-core also requires manual update as it is not templated.
14-
sphinx==4.5.0
15-
-e .

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
package_dir={'': '.'},
4949
packages=packages,
5050
install_requires=dependencies,
51-
python_requires=">=3.9",
51+
python_requires=">=3.10",
5252
include_package_data=True,
5353
zip_safe=False,
5454
**extra_setup

tests/testdata/gapic-combo/docs/pubsub/subscriber/api/message.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ Messages
33

44
.. autoclass:: google.cloud.pubsub_v1.subscriber.message.Message
55
:members:
6-
:noindex:

tests/testdata/gapic-combo/docs/pubsub/types.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ Pub/Sub Client Types
33

44
.. automodule:: google.cloud.pubsub_v1.types
55
:members:
6-
:noindex:

tests/testdata/goldens/gapic-combo/google.cloud.pubsub_v1.publisher.futures.Future.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ items:
143143
source:
144144
id: done
145145
path: concurrent/futures/_base.py
146-
startLine: 383
146+
startLine: 395
147147
summary: 'Return True if the future was cancelled or finished executing.
148148
149149
@@ -163,7 +163,7 @@ items:
163163
source:
164164
id: exception
165165
path: concurrent/futures/_base.py
166-
startLine: 453
166+
startLine: 465
167167
summary: 'Return the exception raised by the call that the future represents.
168168
169169
'

tests/testdata/goldens/gapic-combo/google.cloud.pubsub_v1.subscriber.futures.Future.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ items:
6868
source:
6969
id: add_done_callback
7070
path: concurrent/futures/_base.py
71-
startLine: 398
71+
startLine: 410
7272
summary: 'Attaches a callable that will be called when the future finishes.
7373
7474
'
@@ -133,7 +133,7 @@ items:
133133
source:
134134
id: done
135135
path: concurrent/futures/_base.py
136-
startLine: 383
136+
startLine: 395
137137
summary: 'Return True if the future was cancelled or finished executing.
138138
139139
@@ -153,7 +153,7 @@ items:
153153
source:
154154
id: exception
155155
path: concurrent/futures/_base.py
156-
startLine: 453
156+
startLine: 465
157157
summary: 'Return the exception raised by the call that the future represents.
158158
159159
'

tests/testdata/goldens/gapic-combo/google.cloud.pubsub_v1.subscriber.futures.StreamingPullFuture.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ items:
7272
source:
7373
id: add_done_callback
7474
path: concurrent/futures/_base.py
75-
startLine: 398
75+
startLine: 410
7676
summary: 'Attaches a callable that will be called when the future finishes.
7777
7878
'
@@ -132,7 +132,7 @@ items:
132132
source:
133133
id: done
134134
path: concurrent/futures/_base.py
135-
startLine: 383
135+
startLine: 395
136136
summary: 'Return True if the future was cancelled or finished executing.
137137
138138
@@ -152,7 +152,7 @@ items:
152152
source:
153153
id: exception
154154
path: concurrent/futures/_base.py
155-
startLine: 453
155+
startLine: 465
156156
summary: 'Return the exception raised by the call that the future represents.
157157
158158
'
@@ -176,7 +176,7 @@ items:
176176
source:
177177
id: result
178178
path: concurrent/futures/_base.py
179-
startLine: 418
179+
startLine: 430
180180
summary: 'Return the result of the call that the future represents.
181181
182182
'

0 commit comments

Comments
 (0)