Skip to content

Commit 947ff9b

Browse files
feat: Add support for Python 3.14 (#1028)
Towards b/375664027 --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent a441cea commit 947ff9b

File tree

18 files changed

+172
-31
lines changed

18 files changed

+172
-31
lines changed

.github/.OwlBot.lock.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414
docker:
1515
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
16-
digest: sha256:5581906b957284864632cde4e9c51d1cc66b0094990b27e689132fe5cd036046
16+
digest: sha256:fbbc8db67afd8b7d71bf694c5081a32da0c528eba166fbcffb3b6e56ddf907d5

.github/workflows/unittest.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- main
5+
name: unittest
6+
jobs:
7+
unit:
8+
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
9+
# Use ubuntu-22.04 until Python 3.7 is removed from the test matrix
10+
# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
11+
runs-on: ubuntu-22.04
12+
strategy:
13+
matrix:
14+
python: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: Setup Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: ${{ matrix.python }}
22+
- name: Install nox
23+
run: |
24+
python -m pip install --upgrade setuptools pip wheel
25+
python -m pip install nox
26+
- name: Run unit tests
27+
env:
28+
COVERAGE_FILE: .coverage-${{ matrix.python }}
29+
run: |
30+
nox -s unit-${{ matrix.python }}
31+
- name: Upload coverage results
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: coverage-artifact-${{ matrix.python }}
35+
path: .coverage-${{ matrix.python }}
36+
include-hidden-files: true
37+
38+
cover:
39+
runs-on: ubuntu-latest
40+
needs:
41+
- unit
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v4
45+
- name: Setup Python
46+
uses: actions/setup-python@v5
47+
with:
48+
python-version: "3.14"
49+
- name: Install coverage
50+
run: |
51+
python -m pip install --upgrade setuptools pip wheel
52+
python -m pip install coverage
53+
- name: Download coverage results
54+
uses: actions/download-artifact@v4
55+
with:
56+
path: .coverage-results/
57+
- name: Report coverage results
58+
run: |
59+
find .coverage-results -type f -name '*.zip' -exec unzip {} \;
60+
coverage combine .coverage-results/**/.coverage*
61+
coverage report --show-missing --fail-under=100

.kokoro/noxfile.py

Lines changed: 1 addition & 1 deletion
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", "3.12", "3.13"]
92+
ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
9393

9494
# Any default versions that should be ignored.
9595
IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]
Lines changed: 40 additions & 0 deletions
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.14"
14+
}
15+
16+
# Declare build specific Cloud project.
17+
env_vars: {
18+
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
19+
value: "python-docs-samples-tests-314"
20+
}
21+
22+
env_vars: {
23+
key: "TRAMPOLINE_BUILD_FILE"
24+
value: "github/python-ndb/.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-ndb/.kokoro/trampoline_v2.sh"
Lines changed: 6 additions & 0 deletions
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+
}
Lines changed: 11 additions & 0 deletions
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-ndb/.kokoro/test-samples-against-head.sh"
11+
}
Lines changed: 6 additions & 0 deletions
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+
}
Lines changed: 6 additions & 0 deletions
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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ In order to add a feature to ``python-ndb``:
2424
documentation (in ``docs/``).
2525

2626
- The feature must work fully on the following CPython versions:
27-
3.7, 3.8, 3.9, 3.10, 3.11, 3.12 and 3.13 on both UNIX and Windows.
27+
3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14 on both UNIX and Windows.
2828

2929
- The feature must not add unnecessary dependencies (where
3030
"unnecessary" is of course subjective, but new dependencies should
@@ -151,7 +151,7 @@ Running System Tests
151151

152152
.. note::
153153

154-
System tests are only configured to run under Python 3.8. For
154+
System tests are only configured to run under Python 3.14. For
155155
expediency, we do not run them in older versions of Python 3.
156156

157157
This alone will not run the tests. You'll need to change some local
@@ -267,6 +267,7 @@ We support:
267267
- `Python 3.11`_
268268
- `Python 3.12`_
269269
- `Python 3.13`_
270+
- `Python 3.14`_
270271

271272
.. _Python 3.7: https://docs.python.org/3.7/
272273
.. _Python 3.8: https://docs.python.org/3.8/
@@ -275,6 +276,7 @@ We support:
275276
.. _Python 3.11: https://docs.python.org/3.11/
276277
.. _Python 3.12: https://docs.python.org/3.12/
277278
.. _Python 3.13: https://docs.python.org/3.13/
279+
.. _Python 3.14: https://docs.python.org/3.14/
278280

279281

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

google/cloud/ndb/_datastore_api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ def __init__(self, options):
196196
self.todo = {}
197197

198198
def full(self):
199-
200199
"""Indicates whether more work can be added to this batch.
201200
202201
Returns:

0 commit comments

Comments
 (0)