Skip to content

Commit 5bbb832

Browse files
authored
feat: support Python 3.10 (#1043)
* feat: support Python 3.10 * fix pandas deps to match reality * run system tests with 3.10 * avoid geopandas on Python 3.10 * install google-cloud-bigquery from source * update kokoro configs * remove Python 2.7 config
1 parent fe16adc commit 5bbb832

File tree

9 files changed

+42
-24
lines changed

9 files changed

+42
-24
lines changed

.kokoro/presubmit/prerelease-deps-3.8.cfg

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
# Only run this nox session.
44
env_vars: {
55
key: "NOX_SESSION"
6-
value: "prerelease_deps"
7-
}
6+
value: "prerelease_deps-3.8"
7+
}

.kokoro/presubmit/snippets-3.10.cfg

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Only run this nox session.
4+
env_vars: {
5+
key: "NOX_SESSION"
6+
value: "snippets-3.10"
7+
}

.kokoro/presubmit/snippets-2.7.cfg renamed to .kokoro/presubmit/system-3.10.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
# Only run this nox session.
44
env_vars: {
55
key: "NOX_SESSION"
6-
value: "snippets-2.7"
6+
value: "system-3.10"
77
}

noxfile.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
BLACK_PATHS = ("docs", "google", "samples", "tests", "noxfile.py", "setup.py")
2828

2929
DEFAULT_PYTHON_VERSION = "3.8"
30-
SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"]
31-
UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]
30+
SYSTEM_TEST_PYTHON_VERSIONS = ["3.8", "3.10"]
31+
UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"]
3232
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
3333

3434
# 'docfx' is excluded since it only needs to run in 'docs-presubmit'
@@ -69,7 +69,12 @@ def default(session, install_extras=True):
6969
constraints_path,
7070
)
7171

72-
install_target = ".[all]" if install_extras else "."
72+
if install_extras and session.python == "3.10":
73+
install_target = ".[bqstorage,pandas,tqdm,opentelemetry]"
74+
elif install_extras:
75+
install_target = ".[all]"
76+
else:
77+
install_target = "."
7378
session.install("-e", install_target, "-c", constraints_path)
7479

7580
session.install("ipython", "-c", constraints_path)
@@ -153,7 +158,11 @@ def system(session):
153158
# Data Catalog needed for the column ACL test with a real Policy Tag.
154159
session.install("google-cloud-datacatalog", "-c", constraints_path)
155160

156-
session.install("-e", ".[all]", "-c", constraints_path)
161+
if session.python == "3.10":
162+
extras = "[bqstorage,pandas,tqdm,opentelemetry]"
163+
else:
164+
extras = "[all]"
165+
session.install("-e", f".{extras}", "-c", constraints_path)
157166
session.install("ipython", "-c", constraints_path)
158167

159168
# Run py.test against the system tests.

samples/geography/noxfile_config.py

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

2323
TEST_CONFIG_OVERRIDE = {
2424
# You can opt out from the test for specific Python versions.
25-
"ignored_versions": ["2.7"],
25+
"ignored_versions": [
26+
"2.7",
27+
# TODO: Enable 3.10 once there is a geopandas/fiona release.
28+
# https://github.com/Toblerity/Fiona/issues/1043
29+
"3.10",
30+
],
2631
# An envvar key for determining the project id to use. Change it
2732
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
2833
# build specific Cloud project. You can also use your own string

samples/geography/requirements.txt

+3-5
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,12 @@ importlib-metadata==4.8.1
2424
libcst==0.3.21
2525
munch==2.5.0
2626
mypy-extensions==0.4.3
27-
numpy==1.19.5; python_version < "3.7"
28-
numpy==1.21.2; python_version > "3.6"
2927
packaging==21.0
3028
pandas==1.1.5; python_version < '3.7'
31-
pandas==1.3.2; python_version >= '3.7'
29+
pandas==1.3.4; python_version >= '3.7'
3230
proto-plus==1.19.2
3331
protobuf==3.18.0
34-
pyarrow==5.0.0
32+
pyarrow==6.0.0
3533
pyasn1==0.4.8
3634
pyasn1-modules==0.2.8
3735
pycparser==2.20
@@ -43,7 +41,7 @@ pytz==2021.1
4341
PyYAML==5.4.1
4442
requests==2.26.0
4543
rsa==4.7.2
46-
Shapely==1.7.1
44+
Shapely==1.8.0
4745
six==1.16.0
4846
typing-extensions==3.10.0.2
4947
typing-inspect==0.7.1

samples/magics/requirements.txt

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
google-cloud-bigquery==2.27.1
21
google-cloud-bigquery-storage==2.9.0
32
google-auth-oauthlib==0.4.6
43
grpcio==1.41.0
54
ipython==7.16.1; python_version < '3.7'
6-
ipython==7.17.0; python_version >= '3.7'
5+
ipython==7.29.0; python_version >= '3.7'
76
matplotlib==3.3.4; python_version < '3.7'
8-
matplotlib==3.4.1; python_version >= '3.7'
7+
matplotlib==3.5.0rc1; python_version >= '3.7'
98
pandas==1.1.5; python_version < '3.7'
10-
pandas==1.3.2; python_version >= '3.7'
11-
pyarrow==5.0.0
9+
pandas==1.3.4; python_version >= '3.7'
10+
pyarrow==6.0.0
1211
pytz==2021.1

samples/snippets/requirements.txt

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
google-cloud-bigquery==2.27.1
21
google-cloud-bigquery-storage==2.9.0
32
google-auth-oauthlib==0.4.6
43
grpcio==1.41.0
54
ipython==7.16.1; python_version < '3.7'
6-
ipython==7.17.0; python_version >= '3.7'
5+
ipython==7.29.0; python_version >= '3.7'
76
matplotlib==3.3.4; python_version < '3.7'
87
matplotlib==3.4.1; python_version >= '3.7'
98
pandas==1.1.5; python_version < '3.7'
10-
pandas==1.3.2; python_version >= '3.7'
11-
pyarrow==5.0.0
9+
pandas==1.3.4; python_version >= '3.7'
10+
pyarrow==6.0.0
1211
pytz==2021.1

setup.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
]
6060
+ pyarrow_dep,
6161
"geopandas": ["geopandas>=0.9.0, <1.0dev", "Shapely>=1.6.0, <2.0dev"],
62-
"pandas": ["pandas>=0.23.0"] + pyarrow_dep,
62+
"pandas": ["pandas>=0.24.2"] + pyarrow_dep,
6363
"bignumeric_type": pyarrow_dep,
6464
"tqdm": ["tqdm >= 4.7.4, <5.0.0dev"],
6565
"opentelemetry": [
@@ -127,6 +127,7 @@
127127
"Programming Language :: Python :: 3.7",
128128
"Programming Language :: Python :: 3.8",
129129
"Programming Language :: Python :: 3.9",
130+
"Programming Language :: Python :: 3.10",
130131
"Operating System :: OS Independent",
131132
"Topic :: Internet",
132133
],
@@ -135,7 +136,7 @@
135136
namespace_packages=namespaces,
136137
install_requires=dependencies,
137138
extras_require=extras,
138-
python_requires=">=3.6, <3.10",
139+
python_requires=">=3.6, <3.11",
139140
include_package_data=True,
140141
zip_safe=False,
141142
)

0 commit comments

Comments
 (0)