Skip to content

Commit 8952f02

Browse files
gcf-owl-bot[bot]partheaLinchin
authoredDec 2, 2023
feat: Add support for Python 3.12 (#923)
* chore(python): Add Python 3.12 Source-Link: googleapis/synthtool@af16e6d Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:bacc3af03bff793a03add584537b36b5644342931ad989e3ba1171d3bd5399f5 * Add python 3.11 to owlbot.py and setup.py * Add python 3.12 to owlbot.py and setup.py * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add extras for python 3.12 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add constraints file for python 3.12 * allow python 3.12 in setup.py * update samples requirements --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]> Co-authored-by: Linchin <[email protected]>
1 parent 42a2df7 commit 8952f02

13 files changed

+103
-19
lines changed
 

‎.github/.OwlBot.lock.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
# limitations under the License.
1414
docker:
1515
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
16-
digest: sha256:caffe0a9277daeccc4d1de5c9b55ebba0901b57c2f713ec9c876b0d4ec064f61
17-
# created: 2023-11-08T19:46:45.022803742Z
16+
digest: sha256:bacc3af03bff793a03add584537b36b5644342931ad989e3ba1171d3bd5399f5
17+
# created: 2023-11-23T18:17:28.105124211Z

‎.kokoro/samples/python3.12/common.cfg

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Build logs will be here
4+
action {
5+
define_artifacts {
6+
regex: "**/*sponge_log.xml"
7+
}
8+
}
9+
10+
# Specify which tests to run
11+
env_vars: {
12+
key: "RUN_TESTS_SESSION"
13+
value: "py-3.12"
14+
}
15+
16+
# Declare build specific Cloud project.
17+
env_vars: {
18+
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
19+
value: "python-docs-samples-tests-312"
20+
}
21+
22+
env_vars: {
23+
key: "TRAMPOLINE_BUILD_FILE"
24+
value: "github/python-bigquery-sqlalchemy/.kokoro/test-samples.sh"
25+
}
26+
27+
# Configure the docker image for kokoro-trampoline.
28+
env_vars: {
29+
key: "TRAMPOLINE_IMAGE"
30+
value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
31+
}
32+
33+
# Download secrets for samples
34+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
35+
36+
# Download trampoline resources.
37+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
38+
39+
# Use the trampoline script to run in docker.
40+
build_file: "python-bigquery-sqlalchemy/.kokoro/trampoline_v2.sh"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "True"
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "True"
6+
}
7+
8+
env_vars: {
9+
key: "TRAMPOLINE_BUILD_FILE"
10+
value: "github/python-bigquery-sqlalchemy/.kokoro/test-samples-against-head.sh"
11+
}
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "False"
6+
}
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "True"
6+
}

‎CONTRIBUTING.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ In order to add a feature:
2222
documentation.
2323

2424
- The feature must work fully on the following CPython versions:
25-
3.8, 3.9, 3.10 and 3.11 on both UNIX and Windows.
25+
3.8, 3.9, 3.10, 3.11 and 3.12 on both UNIX and Windows.
2626

2727
- The feature must not add unnecessary dependencies (where
2828
"unnecessary" is of course subjective, but new dependencies should
@@ -72,7 +72,7 @@ We use `nox <https://nox.readthedocs.io/en/latest/>`__ to instrument our tests.
7272

7373
- To run a single unit test::
7474

75-
$ nox -s unit-3.11 -- -k <name of test>
75+
$ nox -s unit-3.12 -- -k <name of test>
7676

7777

7878
.. note::
@@ -143,12 +143,12 @@ Running System Tests
143143
$ nox -s system
144144

145145
# Run a single system test
146-
$ nox -s system-3.11 -- -k <name of test>
146+
$ nox -s system-3.12 -- -k <name of test>
147147

148148

149149
.. note::
150150

151-
System tests are only configured to run under Python 3.8 and 3.11.
151+
System tests are only configured to run under Python 3.8, 3.11 and 3.12.
152152
For expediency, we do not run them in older versions of Python 3.
153153

154154
This alone will not run the tests. You'll need to change some local
@@ -225,11 +225,13 @@ We support:
225225
- `Python 3.9`_
226226
- `Python 3.10`_
227227
- `Python 3.11`_
228+
- `Python 3.12`_
228229

229230
.. _Python 3.8: https://docs.python.org/3.8/
230231
.. _Python 3.9: https://docs.python.org/3.9/
231232
.. _Python 3.10: https://docs.python.org/3.10/
232233
.. _Python 3.11: https://docs.python.org/3.11/
234+
.. _Python 3.12: https://docs.python.org/3.12/
233235

234236

235237
Supported versions can be found in our ``noxfile.py`` `config`_.

‎noxfile.py

+14-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
DEFAULT_PYTHON_VERSION = "3.8"
3737

38-
UNIT_TEST_PYTHON_VERSIONS: List[str] = ["3.8", "3.9", "3.10", "3.11"]
38+
UNIT_TEST_PYTHON_VERSIONS: List[str] = ["3.8", "3.9", "3.10", "3.11", "3.12"]
3939
UNIT_TEST_STANDARD_DEPENDENCIES = [
4040
"mock",
4141
"asyncmock",
@@ -60,9 +60,14 @@
6060
"geography",
6161
"bqstorage",
6262
],
63+
"3.12": [
64+
"tests",
65+
"geography",
66+
"bqstorage",
67+
],
6368
}
6469

65-
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.8", "3.11"]
70+
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.8", "3.11", "3.12"]
6671
SYSTEM_TEST_STANDARD_DEPENDENCIES: List[str] = [
6772
"mock",
6873
"pytest",
@@ -85,6 +90,11 @@
8590
"geography",
8691
"bqstorage",
8792
],
93+
"3.12": [
94+
"tests",
95+
"geography",
96+
"bqstorage",
97+
],
8898
}
8999

90100
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
@@ -195,7 +205,7 @@ def default(session, install_extras=True):
195205
)
196206
install_unittest_dependencies(session, "-c", constraints_path)
197207

198-
if install_extras and session.python == "3.11":
208+
if install_extras and session.python in ["3.11", "3.12"]:
199209
install_target = ".[geography,alembic,tests,bqstorage]"
200210
elif install_extras:
201211
install_target = ".[all]"
@@ -370,7 +380,7 @@ def compliance(session):
370380
)
371381
if session.python == "3.8":
372382
extras = "[tests,alembic]"
373-
elif session.python == "3.11":
383+
elif session.python in ["3.11", "3.12"]:
374384
extras = "[tests,geography]"
375385
else:
376386
extras = "[tests]"

‎owlbot.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@
3131
extras_by_python = {
3232
"3.8": ["tests", "alembic", "bqstorage"],
3333
"3.11": ["tests", "geography", "bqstorage"],
34+
"3.12": ["tests", "geography", "bqstorage"],
3435
}
3536
templated_files = common.py_library(
36-
unit_test_python_versions=["3.8", "3.9", "3.10", "3.11"],
37-
system_test_python_versions=["3.8", "3.11"],
37+
unit_test_python_versions=["3.8", "3.9", "3.10", "3.11", "3.12"],
38+
system_test_python_versions=["3.8", "3.11", "3.12"],
3839
cov_level=100,
3940
unit_test_extras=extras,
4041
unit_test_extras_by_python=extras_by_python,
@@ -126,7 +127,7 @@ def place_before(path, text, *before_text, escape=None):
126127

127128

128129
install_logic = '''
129-
if install_extras and session.python == "3.11":
130+
if install_extras and session.python in ["3.11", "3.12"]:
130131
install_target = ".[geography,alembic,tests,bqstorage]"
131132
elif install_extras:
132133
install_target = ".[all]"
@@ -173,7 +174,7 @@ def compliance(session):
173174
)
174175
if session.python == "3.8":
175176
extras = "[tests,alembic]"
176-
elif session.python == "3.11":
177+
elif session.python in ["3.11", "3.12"]:
177178
extras = "[tests,geography]"
178179
else:
179180
extras = "[tests]"

‎samples/snippets/noxfile.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def get_pytest_env_vars() -> Dict[str, str]:
8989

9090
# DO NOT EDIT - automatically generated.
9191
# All versions used to test samples.
92-
ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11"]
92+
ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
9393

9494
# Any default versions that should be ignored.
9595
IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]

‎samples/snippets/requirements.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ google-cloud-core==2.3.3
99
google-crc32c==1.5.0
1010
google-resumable-media==2.5.0
1111
googleapis-common-protos==1.60.0
12-
greenlet==2.0.2
13-
grpcio==1.57.0
12+
greenlet==3.0.1
13+
grpcio==1.59.0
1414
grpcio-status==1.57.0
1515
idna==3.4
1616
importlib-resources==6.0.1; python_version >= '3.8'
@@ -26,7 +26,7 @@ python-dateutil==2.8.2
2626
pytz==2023.3
2727
requests==2.31.0
2828
rsa==4.9
29-
shapely==2.0.1
29+
shapely==2.0.2
3030
six==1.16.0
3131
sqlalchemy===1.4.27
3232
typing-extensions==4.7.1

‎setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def readme():
8888
"Programming Language :: Python :: 3.9",
8989
"Programming Language :: Python :: 3.10",
9090
"Programming Language :: Python :: 3.11",
91+
"Programming Language :: Python :: 3.12",
9192
"Operating System :: OS Independent",
9293
"Topic :: Database :: Front-Ends",
9394
],
@@ -103,7 +104,7 @@ def readme():
103104
"sqlalchemy>=1.2.0,<2.0.0dev",
104105
],
105106
extras_require=extras,
106-
python_requires=">=3.8, <3.12",
107+
python_requires=">=3.8, <3.13",
107108
tests_require=["packaging", "pytz"],
108109
entry_points={
109110
"sqlalchemy.dialects": ["bigquery = sqlalchemy_bigquery:BigQueryDialect"]

‎testing/constraints-3.12.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
numpy>=1.23

0 commit comments

Comments
 (0)
Please sign in to comment.