Skip to content

Commit 66e069f

Browse files
authored
feat: add python 3.11 testing (#8872)
* feat: add python 3.11 testing * update dependency scipy to 1.10.0 * update dependency psycopg2-binary to 2.9.5 * exclude python 3.11 for appengine/standard_python3/bigquery * exclude python 3.11 for tests that use google-cloud-bigquery==2.34.4 * update copyright year
1 parent 0071cd6 commit 66e069f

File tree

54 files changed

+205
-56
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+205
-56
lines changed

.kokoro/docker/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ RUN set -ex \
117117
&& export GNUPGHOME="$(mktemp -d)" \
118118
&& echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \
119119
&& /tmp/fetch_gpg_keys.sh \
120-
&& for PYTHON_VERSION in 2.7.18 3.7.12 3.8.13 3.9.13 3.10.5 3.11.1; do \
120+
&& for PYTHON_VERSION in 2.7.18 3.7.16 3.8.16 3.9.16 3.10.9 3.11.1; do \
121121
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" \
122122
&& 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" \
123123
&& gpg --batch --verify python-${PYTHON_VERSION}.tar.xz.asc python-${PYTHON_VERSION}.tar.xz \

.kokoro/python3.11/common.cfg

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Copyright 2023 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Format: //devtools/kokoro/config/proto/build.proto
16+
17+
timeout_mins: 300
18+
19+
# Configure the docker image for kokoro-trampoline.
20+
env_vars: {
21+
key: "TRAMPOLINE_IMAGE"
22+
value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
23+
}
24+
25+
# Download trampoline resources.
26+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
27+
28+
# Use the trampoline script to run in docker.
29+
build_file: "python-docs-samples/.kokoro/trampoline_v2.sh"
30+
31+
# Download secrets from Cloud Storage.
32+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
33+
34+
# Access btlr binaries used in the tests
35+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/btlr"
36+
37+
# Copy results for Resultstore
38+
action {
39+
define_artifacts {
40+
regex: "**/*sponge_log.xml"
41+
}
42+
}
43+
44+
# Specify which tests to run
45+
env_vars: {
46+
key: "RUN_TESTS_SESSION"
47+
value: "py-3.11"
48+
}
49+
50+
# Declare build specific Cloud project. It still uses the common one,
51+
# but we'll update the value once we have more Cloud projects.
52+
env_vars: {
53+
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
54+
value: "python-docs-samples-tests-311"
55+
}
56+
57+
# Number of test workers.
58+
env_vars: {
59+
key: "NUM_TEST_WORKERS"
60+
value: "10"
61+
}
62+
63+
env_vars: {
64+
key: "TRAMPOLINE_DOCKERFILE"
65+
value: ".kokoro/docker/Dockerfile"
66+
}

.kokoro/python3.11/continuous.cfg

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2023 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Format: //devtools/kokoro/config/proto/build.proto
16+
17+
# Tell the trampoline which build file to use.
18+
env_vars: {
19+
key: "TRAMPOLINE_BUILD_FILE"
20+
value: ".kokoro/tests/run_tests_diff_head.sh"
21+
}

.kokoro/python3.11/periodic.cfg

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2023 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Format: //devtools/kokoro/config/proto/build.proto
16+
17+
# Tell the trampoline which build file to use.
18+
env_vars: {
19+
key: "TRAMPOLINE_BUILD_FILE"
20+
value: ".kokoro/tests/run_tests.sh"
21+
}
22+
23+
env_vars: {
24+
key: "REPORT_TO_BUILD_COP_BOT"
25+
value: "true"
26+
}
27+
28+
# Tell Trampoline to upload the Docker image after successfull build.
29+
env_vars: {
30+
key: "TRAMPOLINE_IMAGE_UPLOAD"
31+
value: "true"
32+
}

.kokoro/python3.11/presubmit.cfg

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2023 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Format: //devtools/kokoro/config/proto/build.proto
16+
17+
# Tell the trampoline which build file to use.
18+
env_vars: {
19+
key: "TRAMPOLINE_BUILD_FILE"
20+
value: ".kokoro/tests/run_tests_diff_main.sh"
21+
}

MAC_SETUP.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,25 @@ test their code.
7676
```console
7777
$ pyenv install 3.6.13
7878
```
79-
* 3.7.13 (latest 3.7.x release)
79+
* 3.7.16 (latest 3.7.x release)
8080
```console
81-
$ pyenv install 3.7.13
81+
$ pyenv install 3.7.16
8282
```
83-
* 3.8.13 (latest 3.8.x release)
83+
* 3.8.16 (latest 3.8.x release)
8484
```console
85-
$ pyenv install 3.8.13
85+
$ pyenv install 3.8.16
8686
```
87-
* 3.9.12 (latest 3.9.x release)
87+
* 3.9.16 (latest 3.9.x release)
8888
```console
89-
$ pyenv install 3.9.12
89+
$ pyenv install 3.9.16
9090
```
91-
* 3.10.4 (latest 3.10.x release)
91+
* 3.10.9 (latest 3.10.x release)
9292
```console
93-
$ pyenv install 3.10.4
93+
$ pyenv install 3.10.9
94+
```
95+
* 3.11.1 (latest 3.11.x release)
96+
```console
97+
$ pyenv install 3.11.1
9498
```
9599
96100
> ℹ️ *Note*: If you are using an M1 Mac,

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Python samples for [Google Cloud Platform products][cloud].
44

5-
[![Build Status][py-2.7-shield]][py-2.7-link] [![Build Status][py-3.7-shield]][py-3.7-link] [![Build Status][py-3.8-shield]][py-3.8-link] [![Build Status][py-3.9-shield]][py-3.9-link] [![Build Status][py-3.10-shield]][py-3.10-link]
5+
[![Build Status][py-2.7-shield]][py-2.7-link] [![Build Status][py-3.7-shield]][py-3.7-link] [![Build Status][py-3.8-shield]][py-3.8-link] [![Build Status][py-3.9-shield]][py-3.9-link] [![Build Status][py-3.10-shield]][py-3.10-link] [![Build Status][py-3.11-shield]][py-3.11-link]
66

77
## Google Cloud Samples
88

@@ -77,3 +77,5 @@ Contributions welcome! See the [Contributing Guide](CONTRIBUTING.md).
7777
[py-3.9-link]: https://storage.googleapis.com/cloud-devrel-public/python-docs-samples/badges/py-3.9.html
7878
[py-3.10-shield]: https://storage.googleapis.com/cloud-devrel-public/python-docs-samples/badges/py-310.svg
7979
[py-3.10-link]: https://storage.googleapis.com/cloud-devrel-public/python-docs-samples/badges/py-3.10.html
80+
[py-3.11-shield]: https://storage.googleapis.com/cloud-devrel-public/python-docs-samples/badges/py-311.svg
81+
[py-3.11-link]: https://storage.googleapis.com/cloud-devrel-public/python-docs-samples/badges/py-3.11.html
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Django==4.0.4; python_version >= '3.8'
22
Django==3.2.14; python_version < '3.8'
33
gunicorn==20.1.0
4-
psycopg2-binary==2.9.4
4+
psycopg2-binary==2.9.5
55
django-environ==0.9.0
66
google-cloud-secret-manager==2.12.0
77
django-storages[google]==1.13

appengine/flexible/scipy/noxfile_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
TEST_CONFIG_OVERRIDE = {
2424
# You can opt out from the test for specific Python versions.
25-
"ignored_versions": ["2.7", "3.6"],
25+
"ignored_versions": ["2.7", "3.6", "3.11"],
2626
# Old samples are opted out of enforcing Python type hints
2727
# All new samples should feature them
2828
"enforce_type_hints": False,

appengine/flexible/scipy/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ imageio==2.14.0
55
numpy==1.22.0; python_version > "3.7"
66
numpy==1.21.4; python_version <= "3.7"
77
pillow==9.2.0
8-
scipy==1.8.0; python_version > "3.7"
8+
scipy==1.10.0; python_version > "3.7"
99
scipy==1.7.3; python_version <= "3.7"

appengine/standard/noxfile-template.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ def get_pytest_env_vars():
8181

8282
# DO NOT EDIT - automatically generated.
8383
# All versions used to tested samples.
84-
ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10"]
84+
ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
8585

8686
# Any default versions that should be ignored.
87-
IGNORED_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"]
87+
IGNORED_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
8888

8989
TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])
9090

appengine/standard_python3/bigquery/noxfile_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
TEST_CONFIG_OVERRIDE = {
2424
# You can opt out from the test for specific Python versions.
2525
# There's no google-cloud-bigquery package for Python 3.9.
26-
"ignored_versions": ["2.7", "3.6", "3.9"],
26+
"ignored_versions": ["2.7", "3.6", "3.9", "3.11"],
2727
# Old samples are opted out of enforcing Python type hints
2828
# All new samples should feature them
2929
"enforce_type_hints": False,

appengine/standard_python3/cloud_debugger/noxfile_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
TEST_CONFIG_OVERRIDE = {
2424
# You can opt out from the test for specific Python versions.
25-
"ignored_versions": ["2.7", "3.6", "3.10"],
25+
"ignored_versions": ["2.7", "3.6", "3.10", "3.11"],
2626
# Old samples are opted out of enforcing Python type hints
2727
# All new samples should feature them
2828
"enforce_type_hints": False,
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
flask==2.1.0
22
# psycopg2==2.8.4
3-
psycopg2-binary==2.9.4 # you will need either the binary or the regular - for more info see http://initd.org/psycopg/docs/install.html
3+
psycopg2-binary==2.9.5 # you will need either the binary or the regular - for more info see http://initd.org/psycopg/docs/install.html
44
PyMySQL==1.0.2
55
SQLAlchemy==1.4.38
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Django==4.0.4; python_version >= '3.8'
22
Django==3.2.14; python_version < '3.8'
33
django-environ==0.9.0
4-
psycopg2-binary==2.9.4
4+
psycopg2-binary==2.9.5
55
google-cloud-secret-manager==2.12.0

bigquery/bqml/noxfile_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
TEST_CONFIG_OVERRIDE = {
2424
# You can opt out from the test for specific Python versions.
2525
# Skipping for Python 3.9 due to pyarrow compilation failure.
26-
"ignored_versions": ["2.7", "3.6", "3.9"],
26+
"ignored_versions": ["2.7", "3.6", "3.9", "3.11"],
2727
# Old samples are opted out of enforcing Python type hints
2828
# All new samples should feature them
2929
"enforce_type_hints": False,

bigquery/datalab-migration/noxfile_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
TEST_CONFIG_OVERRIDE = {
2424
# You can opt out from the test for specific Python versions.
2525
# Skipping 3.6 and 3.7 to avoid needing a vulnerable version of IPython
26-
"ignored_versions": ["2.7", "3.6", "3.7"],
26+
"ignored_versions": ["2.7", "3.6", "3.7", "3.11"],
2727
# Old samples are opted out of enforcing Python type hints
2828
# All new samples should feature them
2929
"enforce_type_hints": False,

bigquery/pandas-gbq-migration/noxfile_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
TEST_CONFIG_OVERRIDE = {
2424
# You can opt out from the test for specific Python versions.
2525
# Skipping for Python 3.9 due to pyarrow compilation failure.
26-
"ignored_versions": ["2.7", "3.6", "3.9"],
26+
"ignored_versions": ["2.7", "3.6", "3.9", "3.11"],
2727
# Old samples are opted out of enforcing Python type hints
2828
# All new samples should feature them
2929
"enforce_type_hints": False,

cloud-sql/mysql/client-side-encryption/noxfile_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
TEST_CONFIG_OVERRIDE = {
2424
# You can opt out from the test for specific Python versions.
25-
"ignored_versions": ["2.7", "3.6", "3.10"],
25+
"ignored_versions": ["2.7", "3.6", "3.10", "3.11"],
2626
# Old samples are opted out of enforcing Python type hints
2727
# All new samples should feature them
2828
"enforce_type_hints": True,

cloud-sql/postgres/client-side-encryption/noxfile_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
TEST_CONFIG_OVERRIDE = {
2424
# You can opt out from the test for specific Python versions.
25-
"ignored_versions": ["2.7", "3.6", "3.10"],
25+
"ignored_versions": ["2.7", "3.6", "3.10", "3.11"],
2626
# Old samples are opted out of enforcing Python type hints
2727
# All new samples should feature them
2828
"enforce_type_hints": True,

cloud-sql/sql-server/client-side-encryption/noxfile_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
TEST_CONFIG_OVERRIDE = {
2424
# You can opt out from the test for specific Python versions.
25-
"ignored_versions": ["2.7", "3.6", "3.10"],
25+
"ignored_versions": ["2.7", "3.6", "3.10", "3.11"],
2626
# Old samples are opted out of enforcing Python type hints
2727
# All new samples should feature them
2828
"enforce_type_hints": False,

composer/2022_airflow_summit/constraints.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ prompt-toolkit==3.0.30
427427
proto-plus==1.19.6
428428
protobuf==3.20.0
429429
psutil==5.9.1
430-
psycopg2-binary==2.9.3
430+
psycopg2-binary==2.9.5
431431
ptyprocess==0.7.0
432432
pure-eval==0.2.2
433433
pure-sasl==0.6.2

composer/2022_airflow_summit/noxfile_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
TEST_CONFIG_OVERRIDE = {
3232
# You can opt out from the test for specific Python versions.
33-
'ignored_versions': ["2.7", "3.6", "3.7", "3.9", "3.10"], # Composer w/ Airflow 2 only supports Python 3.8
33+
'ignored_versions': ["2.7", "3.6", "3.7", "3.9", "3.10", "3.11"], # Composer w/ Airflow 2 only supports Python 3.8
3434
# Old samples are opted out of enforcing Python type hints
3535
# All new samples should feature them
3636
"enforce_type_hints": False,

composer/airflow_1_samples/noxfile_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
TEST_CONFIG_OVERRIDE = {
3232
# You can opt out from the test for specific Python versions.
3333
# Skipping for Python 3.9 due to numpy compilation failure.
34-
"ignored_versions": ["2.7", "3.9", "3.10"],
34+
"ignored_versions": ["2.7", "3.9", "3.10", "3.11"],
3535
# Old samples are opted out of enforcing Python type hints
3636
# All new samples should feature them
3737
"enforce_type_hints": False,

composer/blog/gcp-tech-blog/data-orchestration-with-composer/constraints.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ prompt-toolkit==3.0.30
427427
proto-plus==1.19.6
428428
protobuf==3.20.0
429429
psutil==5.9.1
430-
psycopg2-binary==2.9.3
430+
psycopg2-binary==2.9.5
431431
ptyprocess==0.7.0
432432
pure-eval==0.2.2
433433
pure-sasl==0.6.2

composer/blog/gcp-tech-blog/data-orchestration-with-composer/noxfile_config.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"3.6",
3737
"3.7",
3838
"3.9",
39-
"3.10"
39+
"3.10",
40+
"3.11",
4041
], # Composer w/ Airflow 2 only supports Python 3.8
4142
# Old samples are opted out of enforcing Python type hints
4243
# All new samples should feature them

composer/blog/gcp-tech-blog/unit-test-dags-cloud-build/noxfile_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
TEST_CONFIG_OVERRIDE = {
3333
# You can opt out from the test for specific Python versions.
3434
# Skipping for Python 3.9 due to numpy compilation failure.
35-
"ignored_versions": ["2.7", "3.9", "3.10"],
35+
"ignored_versions": ["2.7", "3.9", "3.10", "3.11"],
3636
# Old samples are opted out of enforcing Python type hints
3737
# All new samples should feature them
3838
"enforce_type_hints": False,

composer/cicd_sample/constraints.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ prompt-toolkit==3.0.30
427427
proto-plus==1.19.6
428428
protobuf==3.20.0
429429
psutil==5.9.1
430-
psycopg2-binary==2.9.3
430+
psycopg2-binary==2.9.5
431431
ptyprocess==0.7.0
432432
pure-eval==0.2.2
433433
pure-sasl==0.6.2

composer/cicd_sample/noxfile_config.py

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"3.7",
3737
"3.9",
3838
"3.10",
39+
"3.11",
3940
], # Composer w/ Airflow 2 only supports Python 3.8
4041
# Old samples are opted out of enforcing Python type hints
4142
# All new samples should feature them

0 commit comments

Comments
 (0)