Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5d613ac
feat(handwritten): centralize mypy.ini and update noxfiles
chalmerlowe Jun 9, 2026
227d996
style(mypy): format modified noxfile.py files with black
chalmerlowe Jun 9, 2026
4466561
fix(handwritten): use dynamic parent-directory traversal for mypy.ini…
chalmerlowe Jun 23, 2026
2e9fbaa
style(handwritten): format modified noxfiles according to style guide
chalmerlowe Jun 23, 2026
06252df
chore: restore mypy.ini and noxfile.py for google-crc32c
chalmerlowe Jun 25, 2026
6adc2ae
chore: removes blank spaces from file
chalmerlowe Jun 30, 2026
fba4d1a
chore: restores bigframes files due to system test issues
chalmerlowe Jun 30, 2026
5a67697
chore: restores bigframes files due to system test issues
chalmerlowe Jun 30, 2026
3e04bc3
chore: revert changes for overreaching generated packages
chalmerlowe Jun 30, 2026
2b374ce
feat(handwritten): centralize mypy config for hybrid packages and add…
chalmerlowe Jun 30, 2026
6c3fdec
chore: remove scratch files from PR
chalmerlowe Jun 30, 2026
e19bad5
feat(handwritten): centralize mypy config for all handwritten packages
chalmerlowe Jun 30, 2026
707b0bd
updates to mypy.ini re: bigtable
chalmerlowe Jul 1, 2026
b5702f7
updates mypy.ini to account for several package specific settings.
chalmerlowe Jul 1, 2026
5ad0e0c
fix: resolve syntax errors in noxfiles due to escaped quotes
chalmerlowe Jul 1, 2026
7dd2a46
fix(mypy): add global ignores for grpc_status and google.api
chalmerlowe Jul 1, 2026
b2349a8
fix(mypy): restore ignores for generated bigtable packages
chalmerlowe Jul 1, 2026
2742557
chore(tests): apply blacken/ruff formatting to modified noxfiles
chalmerlowe Jul 1, 2026
6745ca7
chore: revert sqlalchemy changes to unblock PR
chalmerlowe Jul 6, 2026
9214a56
chore: restore sqlalchemy-bigquery changes
chalmerlowe Jul 6, 2026
518331a
chore: remove bigquery and spanner from centralization PR
chalmerlowe Jul 7, 2026
243ffa8
chore: put bigquery back and remove sqlalchemy-bigquery from centrali…
chalmerlowe Jul 7, 2026
8316d53
Merge branch 'main' into feat/centralize-mypy-handwritten
chalmerlowe Jul 8, 2026
9fff6fc
chore: broaden global ignores in centralized mypy.ini to cover base m…
chalmerlowe Jul 9, 2026
97a3be9
chore: consolidate bigtable mypy config and update comments
chalmerlowe Jul 9, 2026
f4246dc
feat: prepare handwritten libraries for easy mypy activation
chalmerlowe Jul 10, 2026
d1909a8
chore: remove internal readiness plan from git tracking
chalmerlowe Jul 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ replacements:
[mypy-google.cloud.bigtable.data.*]
ignore_errors = False
count: 1
# Note: noxfile.py is heavily customized so we clobber the whole file.
# Note: noxfile.py is heavily customized so we clobber the whole file.
- paths: [
packages/google-cloud-bigtable/noxfile.py
]
Expand Down Expand Up @@ -464,6 +464,16 @@ replacements:
SYSTEM_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {}

CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
# Path to the centralized mypy configuration file at the repository root.
# Search upwards to support running nox from both monorepo packages and integration test goldens.
MYPY_CONFIG_FILE = next(
(
str(p / "mypy.ini")
for p in CURRENT_DIRECTORY.parents
if (p / "mypy.ini").exists()
),
str(CURRENT_DIRECTORY.parent.parent / "mypy.ini"),
)

# 'docfx' is excluded since it only needs to run in 'docs-presubmit'
nox.options.sessions = [
Expand Down Expand Up @@ -573,7 +583,12 @@ replacements:
"types-requests",
)
session.install("google-cloud-testutils")
session.run("mypy", "-p", "google.cloud.bigtable.data")
session.run(
"mypy",
f"--config-file={MYPY_CONFIG_FILE}",
"-p",
"google.cloud.bigtable.data",
)


@nox.session(python=DEFAULT_PYTHON_VERSION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,14 @@ replacements:
-------------------
.. toctree::
:maxdepth: 2

usage

Documentation
-------------------
.. toctree::
:maxdepth: 3

client
logger
entries
Expand All @@ -344,20 +344,20 @@ replacements:
sink
handlers
transport


Migration Guides
----------------

See the guide below for instructions on migrating between major releases of this library.

.. toctree::
:maxdepth: 2

UPGRADING
count: 1
- paths: [
"packages/google-cloud-logging/google/cloud/logging/__init__.py",
"packages/google-cloud-logging/google/cloud/logging/__init__.py",
]
before: |
from google.cloud.logging import gapic_version as package_version
Expand Down Expand Up @@ -463,6 +463,24 @@ replacements:
"django",
]
count: 1
- paths: [
packages/google-cloud-logging/noxfile.py
]
before: |
CURRENT_DIRECTORY = pathlib.Path\(__file__\).parent.absolute\(\)
after: |
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
# Path to the centralized mypy configuration file at the repository root.
# Search upwards to support running nox from both monorepo packages and integration test goldens.
MYPY_CONFIG_FILE = next(
(
str(p / "mypy.ini")
for p in CURRENT_DIRECTORY.parents
if (p / "mypy.ini").exists()
),
str(CURRENT_DIRECTORY.parent.parent / "mypy.ini"),
)
count: 1
- paths: [
packages/google-cloud-logging/noxfile.py
]
Expand All @@ -478,4 +496,19 @@ replacements:
# TODO(https://github.com/googleapis/google-cloud-python/issues/13362):
# Enable mypy once this repo has been updated for mypy evaluation.
session.skip("Skip mypy since this library is not yet updated for mypy evaluation")

session.install("-e", ".")
session.install(
"mypy",
"types-setuptools",
"types-protobuf",
"types-requests",
)
session.run(
"mypy",
f"--config-file={MYPY_CONFIG_FILE}",
"-p",
"google",
*session.posargs,
)
count: 1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
replacements:
- paths:
- paths:
- "packages/google-cloud-pubsub/google/pubsub_v1/services/**/*client.py"
before: 'instead\.\n(?:[ \t]*\n)*([ \t]+)DEFAULT_ENDPOINT = "pubsub\.googleapis\.com"'
after: |-
Expand All @@ -13,7 +13,7 @@ replacements:
\g<1>DEFAULT_ENDPOINT = "pubsub.googleapis.com"
count: 3

- paths:
- paths:
- "packages/google-cloud-pubsub/google/pubsub_v1/services/*/client.py"
before: 'import json\n(?:[ \t]*\n)*import logging as std_logging'
after: |-
Expand All @@ -23,7 +23,7 @@ replacements:
import logging as std_logging
count: 3

- paths:
- paths:
- "packages/google-cloud-pubsub/google/pubsub_v1/services/*/client.py"
before: 'class\n(?:[ \t]*\n)*([ \t]+)self\._transport = transport_init\('
after: |-
Expand All @@ -38,7 +38,7 @@ replacements:
\g<1>self._transport = transport_init(
count: 3

- paths:
- paths:
- "packages/google-cloud-pubsub/google/pubsub_v1/services/*/transports/grpc*.py"
- "packages/google-cloud-pubsub/tests/unit/gapic/pubsub_v1/*.py"
before: '\("grpc\.max_receive_message_length", -1\),\n(?:[ \t]*\n)*([ \t]+)\]'
Expand All @@ -49,19 +49,19 @@ replacements:
\g<1>]
count: 21

- paths:
- paths:
- "packages/google-cloud-pubsub/google/pubsub_v1/services/publisher/transports/base.py"
before: 'deadline=60\.0,'
after: 'deadline=600.0,'
count: 9

- paths:
- paths:
- "packages/google-cloud-pubsub/google/pubsub_v1/services/**/*.py"
before: 'gapic_version=package_version\.__version__'
after: 'client_library_version=package_version.__version__'
count: 9

- paths:
- paths:
- "packages/google-cloud-pubsub/google/pubsub_v1/services/subscriber/client.py"
before: 'import logging as std_logging\n(?:[ \t]*\n)*import os'
after: |-
Expand All @@ -71,7 +71,7 @@ replacements:
import os
count: 1

- paths:
- paths:
- "packages/google-cloud-pubsub/google/pubsub_v1/services/subscriber/async_client.py"
before: 'import logging as std_logging\n(?:[ \t]*\n)*import re'
after: |-
Expand All @@ -80,7 +80,7 @@ replacements:
import re
count: 1

- paths:
- paths:
- "packages/google-cloud-pubsub/google/pubsub_v1/services/subscriber/client.py"
- "packages/google-cloud-pubsub/google/pubsub_v1/services/subscriber/async_client.py"
before: 'request\.max_messages = max_messages\n(?:[ \t]*\n)*([ \t]+)# Wrap the RPC method'
Expand All @@ -96,7 +96,7 @@ replacements:
\g<1># Wrap the RPC method
count: 2

- paths:
- paths:
- "packages/google-cloud-pubsub/google/pubsub_v1/services/subscriber/client.py"
before: '"""\n(?:[ \t]*\n)*([ \t]+)# Wrap the RPC method; this adds retry and timeout information,\n(?:[ \t]*\n)*[ \t]+# and friendly error handling\.\n(?:[ \t]*\n)*[ \t]+rpc = self\._transport\._wrapped_methods\[self\._transport\.streaming_pull\]'
after: |-
Expand Down Expand Up @@ -403,6 +403,16 @@ replacements:
before: 'nox\.options\.sessions = \[\n(?:[ \t]+)"unit",\n(?:[ \t]+)"system",\n(?:[ \t]+)"cover",\n(?:[ \t]+)"lint",\n(?:[ \t]+)"lint_setup_py",\n(?:[ \t]+)"blacken",\n(?:[ \t]+)"docs",\n\]'
after: |-
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
# Path to the centralized mypy configuration file at the repository root.
# Search upwards to support running nox from both monorepo packages and integration test goldens.
MYPY_CONFIG_FILE = next(
(
str(p / "mypy.ini")
for p in CURRENT_DIRECTORY.parents
if (p / "mypy.ini").exists()
),
str(CURRENT_DIRECTORY.parent.parent / "mypy.ini"),
)

nox.options.sessions = [
"unit",
Expand Down Expand Up @@ -450,7 +460,7 @@ replacements:
# mypy checks yet.
# https://github.com/googleapis/gapic-generator-python/issues/1092
# TODO: Re-enable mypy checks once we merge, since incremental checks are failing due to protobuf upgrade
# session.run("mypy", "-p", "google.cloud", "--exclude", "google/pubsub_v1/")
# session.run("mypy", f"--config-file={MYPY_CONFIG_FILE}", "-p", "google.cloud", "--exclude", "google/pubsub_v1/")


@nox.session(python=DEFAULT_PYTHON_VERSION)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
description: Restore handwritten __init__.py for google-cloud-storage
replacements:
- paths: [
packages/google-cloud-storage/noxfile.py,
]
before: |
CURRENT_DIRECTORY = pathlib.Path\(__file__\).parent.absolute\(\)
after: |
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
# Path to the centralized mypy configuration file at the repository root.
# Search upwards to support running nox from both monorepo packages and integration test goldens.
MYPY_CONFIG_FILE = next(
(
str(p / "mypy.ini")
for p in CURRENT_DIRECTORY.parents
if (p / "mypy.ini").exists()
),
str(CURRENT_DIRECTORY.parent.parent / "mypy.ini"),
)
count: 1
- paths: [
packages/google-cloud-storage/noxfile.py,
]
Expand Down Expand Up @@ -804,4 +822,19 @@ replacements:
# TODO(https://github.com/googleapis/google-cloud-python/issues/13362):
# Enable mypy once this repo has been updated for mypy evaluation.
session.skip("Skip mypy since this library is not yet updated for mypy evaluation")

session.install("-e", ".")
session.install(
"mypy",
"types-setuptools",
"types-protobuf",
"types-requests",
)
session.run(
"mypy",
f"--config-file={MYPY_CONFIG_FILE}",
"-p",
"google",
*session.posargs,
)
count: 1
20 changes: 11 additions & 9 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,31 @@ ignore_missing_imports = True
[mypy-flask]
ignore_missing_imports = True

[mypy-google.api.*]
[mypy-google.api,google.api.*]
ignore_missing_imports = True

[mypy-google.colab]
ignore_missing_imports = True

[mypy-google.iam.*]
[mypy-google.iam,google.iam.*]
ignore_missing_imports = True

[mypy-google.longrunning.*]
[mypy-google.longrunning,google.longrunning.*]
ignore_missing_imports = True

[mypy-google.oauth2.*]
[mypy-google.oauth2,google.oauth2.*]
ignore_missing_imports = True

[mypy-google.protobuf.*]
[mypy-google.protobuf,google.protobuf.*]
ignore_missing_imports = True

[mypy-google.rpc.*]
[mypy-google.rpc,google.rpc.*]
ignore_missing_imports = True

[mypy-google.type.*]
[mypy-google.type,google.type.*]
ignore_missing_imports = True

[mypy-grpc.*]
[mypy-grpc,grpc.*]
ignore_missing_imports = True

[mypy-grpc_status]
Expand All @@ -63,7 +63,7 @@ ignore_missing_imports = True
[mypy-ipywidgets]
ignore_missing_imports = True

[mypy-proto.*]
[mypy-proto,proto.*]
ignore_missing_imports = True

[mypy-pyarrow.*]
Expand Down Expand Up @@ -95,9 +95,11 @@ ignore_missing_imports = True
ignore_missing_imports = True

[mypy-google.cloud.bigtable.*]
# Broadly ignore errors for the older, legacy/handwritten parts of the library
ignore_errors = True

[mypy-google.cloud.bigtable.data.*]
# Stricter rules for the newer parts of the library
check_untyped_defs = True
warn_unreachable = True
disallow_any_generics = True
Expand Down
3 changes: 0 additions & 3 deletions packages/bigquery-magics/mypy.ini

This file was deleted.

26 changes: 26 additions & 0 deletions packages/bigquery-magics/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,17 @@
}

CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
# Path to the centralized mypy configuration file at the repository root.
# Search upwards to support running nox from both monorepo packages and integration test goldens.
MYPY_CONFIG_FILE = next(
(
str(p / "mypy.ini")
for p in CURRENT_DIRECTORY.parents
if (p / "mypy.ini").exists()
),
str(CURRENT_DIRECTORY.parent.parent / "mypy.ini"),
)


nox.options.sessions = [
"unit",
Expand Down Expand Up @@ -546,3 +557,18 @@ def mypy(session):
# TODO(https://github.com/googleapis/google-cloud-python/issues/16014):
# Add mypy tests
session.skip("mypy tests are not yet supported")

session.install("-e", ".")
session.install(
"mypy",
"types-setuptools",
"types-protobuf",
"types-requests",
)
session.run(
"mypy",
f"--config-file={MYPY_CONFIG_FILE}",
"-p",
"bigquery_magics",
*session.posargs,
)
Loading
Loading