Skip to content

Commit 263332a

Browse files
feat: Add support for Python 3.14 (#1217)
1 parent f6e41f8 commit 263332a

File tree

24 files changed

+144
-46
lines changed

24 files changed

+144
-46
lines changed

.cross_sync/transformers.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,19 @@ def visit_FunctionDef(self, node):
7171
Replace function docstrings
7272
"""
7373
docstring = ast.get_docstring(node)
74-
if docstring and isinstance(node.body[0], ast.Expr) and isinstance(
75-
node.body[0].value, ast.Str
76-
):
74+
if docstring and isinstance(node.body[0], ast.Expr) \
75+
and isinstance(node.body[0].value, ast.Constant) \
76+
and isinstance(node.body[0].value.value, str) \
77+
:
7778
for key_word, replacement in self.replacements.items():
7879
docstring = docstring.replace(key_word, replacement)
79-
node.body[0].value.s = docstring
80+
node.body[0].value.value = docstring
8081
return self.generic_visit(node)
8182

8283
def visit_Constant(self, node):
8384
"""Replace string type annotations"""
8485
try:
85-
node.s = self.replacements.get(node.s, node.s)
86+
node.value = self.replacements.get(node.value, node.value)
8687
except TypeError:
8788
# ignore unhashable types (e.g. list)
8889
pass
@@ -264,7 +265,7 @@ def get_output_path(self, node):
264265
for target in n.targets:
265266
if isinstance(target, ast.Name) and target.id == self.FILE_ANNOTATION:
266267
# return the output path
267-
return n.value.s.replace(".", "/") + ".py"
268+
return n.value.value.replace(".", "/") + ".py"
268269

269270
def visit_Module(self, node):
270271
# look for __CROSS_SYNC_OUTPUT__ Assign statement

.github/.OwlBot.lock.yaml

Lines changed: 2 additions & 2 deletions
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:5581906b957284864632cde4e9c51d1cc66b0094990b27e689132fe5cd036046
17-
# created: 2025-03-05
16+
digest: sha256:4a9e5d44b98e8672e2037ee22bc6b4f8e844a2d75fcb78ea8a4b38510112abc6
17+
# created: 2025-10-07

.github/sync-repo-settings.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,19 @@ branchProtectionRules:
2929
# List of required status check contexts that must pass for commits to be accepted to matching branches.
3030
requiredStatusCheckContexts:
3131
- 'Kokoro'
32-
- 'Kokoro system-3.8'
32+
- 'Kokoro system'
3333
- 'cla/google'
3434
- 'OwlBot Post Processor'
35+
- 'lint'
36+
- 'mypy'
37+
- 'docs'
38+
- 'docfx'
39+
- 'unit-3.9'
40+
- 'unit-3.10'
41+
- 'unit-3.11'
42+
- 'unit-3.12'
43+
- 'unit-3.13'
44+
- 'unit-3.14'
3545
# List of explicit permissions to add (additive only)
3646
permissionRules:
3747
# Team slug to add to repository permissions

.github/workflows/conformance.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
matrix:
2727
test-version: [ "v0.0.4" ]
28-
py-version: [ 3.8 ]
28+
py-version: [ 3.13 ]
2929
client-type: [ "async", "sync"]
3030
# None of the clients currently support reverse scans, execute query plan refresh, retry info, or routing cookie
3131
include:

.github/workflows/mypy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup Python
1313
uses: actions/setup-python@v5
1414
with:
15-
python-version: "3.8"
15+
python-version: "3.13"
1616
- name: Install nox
1717
run: |
1818
python -m pip install --upgrade setuptools pip wheel

.github/workflows/system_emulated.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Setup Python
1818
uses: actions/setup-python@v5
1919
with:
20-
python-version: '3.8'
20+
python-version: '3.13'
2121

2222
- name: Setup GCloud SDK
2323
uses: google-github-actions/setup-gcloud@v2.1.1

.github/workflows/unittest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-22.04
1212
strategy:
1313
matrix:
14-
python: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
14+
python: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
1515
steps:
1616
- name: Checkout
1717
uses: actions/checkout@v4
Lines changed: 1 addition & 1 deletion
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: "system-3.8"
6+
value: "system-3.9"
77
}

.kokoro/presubmit/system.cfg

Lines changed: 7 additions & 0 deletions
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: "system-3.9"
7+
}
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-bigtable/.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-bigtable/.kokoro/trampoline_v2.sh"

0 commit comments

Comments
 (0)