Skip to content

Commit 07c4c45

Browse files
authored
Merge branch 'main' into feat/centralize-mypy-handwritten
2 parents d1909a8 + c824b6d commit 07c4c45

1,816 files changed

Lines changed: 49520 additions & 14975 deletions

File tree

Some content is hidden

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

.github/workflows/gapic-generator-tests.yml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,8 @@ name: Gapic Generator Specialized Tests
55

66
on:
77
pull_request:
8-
paths:
9-
- 'packages/gapic-generator/**'
10-
- '.github/workflows/gapic-generator-tests.yml'
118
push:
129
branches: [main]
13-
paths:
14-
- 'packages/gapic-generator/**'
1510

1611
concurrency:
1712
group: gapic-gen-${{ github.head_ref || github.run_id }}
@@ -30,11 +25,8 @@ env:
3025
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
3126

3227
jobs:
28+
# Check if the gapic-generator was changed. If so, execute specialized tests
3329
check_changes:
34-
# We use a job-level 'if' with dorny/paths-filter because GitHub's top-level
35-
# 'on: pull_request: paths' can be bypassed during repository-wide migrations
36-
# or structural changes. This ensures these specialized (and heavy) matrix
37-
# jobs stay silent on PRs that do not touch the generator.
3830
runs-on: ubuntu-latest
3931
outputs:
4032
run_generator: ${{ steps.filter.outputs.generator }}
@@ -59,7 +51,7 @@ jobs:
5951
all_python: ${{ env.ALL_PYTHON }}
6052
latest_stable_python: ${{ env.LATEST_STABLE_PYTHON }}
6153
prerelease_python: ${{ env.PRERELEASE_PYTHON }}
62-
trimmed_python: $${{ env.TRIMMED_PYTHON }}
54+
trimmed_python: ${{ env.TRIMMED_PYTHON }}
6355
steps:
6456
- run: echo "Initializing config for gapic-generator"
6557

@@ -232,7 +224,6 @@ jobs:
232224
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
233225
with:
234226
persist-credentials: false
235-
236227
- name: Cache Bazel files
237228
id: cache-bazel
238229
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
@@ -247,3 +238,27 @@ jobs:
247238
# WORKSPACE file is located there.
248239
cd packages/gapic-generator
249240
bazelisk test //tests/integration/... --test_output=errors
241+
242+
# Final job to simplify branch protection rules.
243+
# This job will be reported as 'Success' if all its dependencies either
244+
# pass or are skipped due to path filtering.
245+
status:
246+
needs: [check_changes, python_config, showcase-unit, showcase-mypy, goldens, goldens-prerelease, fragment-snippet, integration]
247+
if: always()
248+
runs-on: ubuntu-latest
249+
steps:
250+
- name: Check all jobs for failure
251+
env:
252+
NEEDS_JSON: ${{ toJson(needs) }}
253+
run: |
254+
# 1. Print a human-readable list of each dependency job and its final status.
255+
echo "Job Results:"
256+
echo "$NEEDS_JSON" | jq -r 'to_entries[] | " - \(.key): \(.value.result)"'
257+
258+
# 2. Evaluate if any job actually failed or was cancelled.
259+
if echo "$NEEDS_JSON" | jq -e 'to_entries[].value | select(.result == "failure" or .result == "cancelled")' >/dev/null; then
260+
echo "Error: One or more required jobs failed or were cancelled."
261+
exit 1
262+
fi
263+
echo "All checks passed or were successfully skipped."
264+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: import-profiler
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- preview
8+
# Trigger workflow on GitHub merge queue events
9+
merge_group:
10+
types: [checks_requested]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
import-profile:
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 60
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v6
22+
with:
23+
fetch-depth: 2
24+
- name: Setup Python
25+
uses: actions/setup-python@v6
26+
with:
27+
python-version: "3.15"
28+
allow-prereleases: true
29+
- name: Run import profiler
30+
env:
31+
BUILD_TYPE: presubmit
32+
TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref }}
33+
TEST_TYPE: import_profile
34+
PY_VERSION: "3.15"
35+
run: |
36+
ci/run_conditional_tests.sh

.librarian/generator-input/client-post-processing/bigtable-integration.yaml

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -357,53 +357,7 @@ replacements:
357357
358358
Quick Start
359359
count: 1
360-
- paths: [
361-
packages/google-cloud-bigtable/mypy.ini
362-
]
363-
before: |
364-
\[mypy\]
365-
[\s\S]*?incremental = True
366-
after: |
367-
[mypy]
368-
python_version = 3.13
369-
namespace_packages = True
370-
check_untyped_defs = True
371-
warn_unreachable = True
372-
disallow_any_generics = True
373-
exclude = tests/unit/gapic/
374-
375-
[mypy-grpc.*]
376-
ignore_missing_imports = True
377-
378-
[mypy-google.auth.*]
379-
ignore_missing_imports = True
380-
381-
[mypy-google.iam.*]
382-
ignore_missing_imports = True
383-
384-
[mypy-google.longrunning.*]
385-
ignore_missing_imports = True
386-
387-
[mypy-google.oauth2.*]
388-
ignore_missing_imports = True
389-
390-
[mypy-google.rpc.*]
391-
ignore_missing_imports = True
392-
393-
[mypy-proto.*]
394-
ignore_missing_imports = True
395-
396-
[mypy-pytest]
397-
ignore_missing_imports = True
398-
399-
[mypy-google.cloud.*]
400-
ignore_errors = True
401-
402-
# only verify data client
403-
[mypy-google.cloud.bigtable.data.*]
404-
ignore_errors = False
405-
count: 1
406-
# Note: noxfile.py is heavily customized so we clobber the whole file.
360+
# Note: noxfile.py is heavily customized so we clobber the whole file.
407361
- paths: [
408362
packages/google-cloud-bigtable/noxfile.py
409363
]

.librarian/generator-input/client-post-processing/datastore-integration.yaml

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -39,42 +39,6 @@ replacements:
3939
"google-cloud-core >= 2.0.0, <3.0.0",
4040
"grpcio >= 1.59.0, < 2.0.0",
4141
count: 1
42-
- paths: [
43-
"packages/google-cloud-datastore/mypy.ini",
44-
]
45-
before: |-
46-
# Performance: reuse results from previous runs to speed up 'nox'
47-
incremental = True
48-
after: |-
49-
# Performance: reuse results from previous runs to speed up "nox"
50-
incremental = True
51-
52-
[mypy-google.cloud.datastore._app_engine_key_pb2]
53-
ignore_errors = True
54-
55-
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2410):
56-
# Remove once this generator bug is fixed
57-
[mypy-google.cloud.datastore_v1.services.datastore.async_client]
58-
ignore_errors = True
59-
60-
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2410):
61-
# Remove once this generator bug is fixed
62-
[mypy-google.cloud.datastore_v1.services.datastore.client]
63-
ignore_errors = True
64-
count: 1
65-
- paths: [
66-
"packages/google-cloud-datastore/mypy.ini",
67-
]
68-
before: |
69-
ignore_missing_imports = False
70-
71-
# TODO\(https://github.com/googleapis/gapic-generator-python/issues/2563\):
72-
# Dependencies that historically lacks py.typed markers
73-
\[mypy-google\.iam\.\*\]
74-
ignore_missing_imports = True
75-
after: |
76-
ignore_missing_imports = True
77-
count: 1
7842
- paths: [
7943
"packages/google-cloud-datastore/docs/index.rst",
8044
]

.release-please-bulk-manifest.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
"packages/google-analytics-data": "0.23.0",
1313
"packages/google-api-core": "2.31.0",
1414
"packages/google-apps-card": "0.7.0",
15-
"packages/google-apps-chat": "0.10.1",
15+
"packages/google-apps-chat": "0.10.2",
1616
"packages/google-apps-events-subscriptions": "0.6.0",
1717
"packages/google-apps-meet": "0.5.0",
1818
"packages/google-apps-script-type": "0.8.0",
1919
"packages/google-area120-tables": "0.15.0",
20-
"packages/google-auth": "2.55.2",
20+
"packages/google-auth": "2.56.0",
2121
"packages/google-auth-httplib2": "0.4.0",
2222
"packages/google-auth-oauthlib": "1.4.0",
2323
"packages/google-backstory": "0.1.0",
@@ -31,7 +31,7 @@
3131
"packages/google-cloud-api-gateway": "1.16.0",
3232
"packages/google-cloud-api-keys": "0.9.0",
3333
"packages/google-cloud-apigee-connect": "1.16.0",
34-
"packages/google-cloud-apigee-registry": "0.10.0",
34+
"packages/google-cloud-apigee-registry": "0.10.1",
3535
"packages/google-cloud-apihub": "0.7.0",
3636
"packages/google-cloud-apiregistry": "0.3.0",
3737
"packages/google-cloud-appengine-admin": "1.18.0",
@@ -68,7 +68,7 @@
6868
"packages/google-cloud-bigtable": "2.40.0",
6969
"packages/google-cloud-billing": "1.20.0",
7070
"packages/google-cloud-billing-budgets": "1.21.0",
71-
"packages/google-cloud-binary-authorization": "1.18.0",
71+
"packages/google-cloud-binary-authorization": "1.19.0",
7272
"packages/google-cloud-build": "3.38.0",
7373
"packages/google-cloud-capacityplanner": "0.5.0",
7474
"packages/google-cloud-certificate-manager": "1.14.0",
@@ -113,7 +113,7 @@
113113
"packages/google-cloud-dms": "1.16.0",
114114
"packages/google-cloud-dns": "0.37.0",
115115
"packages/google-cloud-documentai": "3.15.0",
116-
"packages/google-cloud-documentai-toolbox": "0.17.0",
116+
"packages/google-cloud-documentai-toolbox": "0.17.1",
117117
"packages/google-cloud-domains": "1.14.0",
118118
"packages/google-cloud-edgecontainer": "0.8.1",
119119
"packages/google-cloud-edgenetwork": "0.5.1",
@@ -154,7 +154,7 @@
154154
"packages/google-cloud-managedkafka-schemaregistry": "0.4.1",
155155
"packages/google-cloud-media-translation": "0.14.1",
156156
"packages/google-cloud-memcache": "1.16.0",
157-
"packages/google-cloud-memorystore": "0.5.1",
157+
"packages/google-cloud-memorystore": "0.5.2",
158158
"packages/google-cloud-migrationcenter": "0.4.1",
159159
"packages/google-cloud-modelarmor": "0.7.1",
160160
"packages/google-cloud-monitoring": "2.31.0",
@@ -210,7 +210,7 @@
210210
"packages/google-cloud-source-context": "1.11.0",
211211
"packages/google-cloud-spanner": "3.69.0",
212212
"packages/google-cloud-speech": "2.40.0",
213-
"packages/google-cloud-storage": "3.12.1",
213+
"packages/google-cloud-storage": "3.13.0",
214214
"packages/google-cloud-storage-control": "1.12.0",
215215
"packages/google-cloud-storage-transfer": "1.21.0",
216216
"packages/google-cloud-storagebatchoperations": "0.8.0",
@@ -240,7 +240,7 @@
240240
"packages/google-cloud-workloadmanager": "0.2.1",
241241
"packages/google-cloud-workstations": "0.8.1",
242242
"packages/google-developer-knowledge": "0.1.0",
243-
"packages/google-devicesandservices-health": "0.1.0",
243+
"packages/google-devicesandservices-health": "0.1.1",
244244
"packages/google-geo-type": "0.7.0",
245245
"packages/google-maps-addressvalidation": "0.7.0",
246246
"packages/google-maps-areainsights": "0.5.0",

ci/run_single_test.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,62 @@ case ${TEST_TYPE} in
105105
;;
106106
esac
107107
;;
108+
import_profile)
109+
if [ -f setup.py ] || [ -f pyproject.toml ]; then
110+
echo "Creating temporary virtualenv for import profile..."
111+
python3 -m venv .venv-profiler
112+
source .venv-profiler/bin/activate
113+
python -m pip install --upgrade pip setuptools
114+
115+
PACKAGE_NAME=$(basename $(pwd))
116+
PROFILER_TEMP_DIR=$(mktemp -d)
117+
cp ../../scripts/import_profiler/profiler.py "${PROFILER_TEMP_DIR}/profiler.py"
118+
PROFILER_SCRIPT="${PROFILER_TEMP_DIR}/profiler.py"
119+
BASELINE_CSV="${PROFILER_TEMP_DIR}/baseline_${PACKAGE_NAME}.csv"
120+
121+
if [ -n "${TARGET_BRANCH}" ]; then
122+
# Try upstream first (for forks), then origin
123+
BASELINE_COMMIT=$(git merge-base HEAD "upstream/${TARGET_BRANCH}" 2>/dev/null || \
124+
git merge-base HEAD "origin/${TARGET_BRANCH}" 2>/dev/null || \
125+
git merge-base HEAD "${TARGET_BRANCH}" 2>/dev/null || true)
126+
if [ -n "${BASELINE_COMMIT}" ]; then
127+
echo "Checking out baseline commit ${BASELINE_COMMIT} in a temporary worktree..."
128+
REPO_PREFIX=$(git rev-parse --show-prefix)
129+
WORKTREE_DIR=$(mktemp -d)
130+
rmdir "${WORKTREE_DIR}"
131+
if git worktree add "${WORKTREE_DIR}" "${BASELINE_COMMIT}" 2>/dev/null; then
132+
(
133+
cd "${WORKTREE_DIR}/${REPO_PREFIX}"
134+
if [ -f setup.py ] || [ -f pyproject.toml ]; then
135+
pip install -e .
136+
python "${PROFILER_SCRIPT}" --package "${PACKAGE_NAME}" --iterations 11 --csv "${BASELINE_CSV}"
137+
fi
138+
)
139+
git worktree remove -f "${WORKTREE_DIR}"
140+
else
141+
echo "Failed to create git worktree for baseline. Skipping baseline generation."
142+
fi
143+
else
144+
echo "Could not find baseline commit for ${TARGET_BRANCH:-main}. Skipping baseline generation."
145+
fi
146+
fi
147+
148+
pip install -e .
149+
150+
if [ -f "${BASELINE_CSV}" ]; then
151+
python ${PROFILER_SCRIPT} --package ${PACKAGE_NAME} --iterations 11 --fail-threshold 5000 --diff-baseline "${BASELINE_CSV}" --diff-threshold 100
152+
else
153+
python ${PROFILER_SCRIPT} --package ${PACKAGE_NAME} --iterations 11 --fail-threshold 5000
154+
fi
155+
retval=$?
156+
deactivate
157+
rm -rf .venv-profiler
158+
rm -rf "${PROFILER_TEMP_DIR}"
159+
else
160+
echo "Skipping import_profile as this does not appear to be a Python package (no setup.py or pyproject.toml)."
161+
retval=0
162+
fi
163+
;;
108164
*)
109165
nox -s ${TEST_TYPE}
110166
retval=$?

0 commit comments

Comments
 (0)