Skip to content

Commit fdf7525

Browse files
committed
feat: centralize mypy config for bigquery
1 parent 6a49390 commit fdf7525

3 files changed

Lines changed: 60 additions & 15 deletions

File tree

mypy.ini

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ exclude = (?x)(
1414
| (^|/)tests/unit/gapic/
1515
)
1616

17-
1817
# ==============================================================================
1918
# GLOBAL THIRD-PARTY & SHARED LIBRARY IGNORES
2019
# ==============================================================================
@@ -28,13 +27,7 @@ ignore_missing_imports = True
2827
[mypy-flask]
2928
ignore_missing_imports = True
3029

31-
[mypy-google.auth.*]
32-
ignore_missing_imports = True
33-
34-
[mypy-google.cloud.bigtable]
35-
ignore_missing_imports = True
36-
37-
[mypy-google.cloud.pubsub]
30+
[mypy-google.api.*]
3831
ignore_missing_imports = True
3932

4033
[mypy-google.colab]
@@ -61,6 +54,9 @@ ignore_missing_imports = True
6154
[mypy-grpc.*]
6255
ignore_missing_imports = True
6356

57+
[mypy-grpc_status]
58+
ignore_missing_imports = True
59+
6460
[mypy-ibis.*]
6561
ignore_missing_imports = True
6662

@@ -86,15 +82,47 @@ ignore_missing_imports = True
8682
# ==============================================================================
8783
# PACKAGE-SPECIFIC OVERRIDES & EXCEPTIONS
8884
# ==============================================================================
85+
# --- bigframes ---
86+
[mypy-bigframes_vendored.*]
87+
ignore_errors = True
88+
89+
# --- google-auth ---
90+
[mypy-google.auth.*]
91+
ignore_missing_imports = True
8992

9093
# --- google-cloud-bigtable ---
91-
[mypy-google.cloud.bigtable.*]
92-
ignore_errors = True
94+
[mypy-google.cloud.bigtable]
95+
ignore_missing_imports = True
9396

94-
[mypy-google.cloud.bigtable.data.*]
97+
[mypy-google.cloud.bigtable.*]
9598
check_untyped_defs = True
9699
warn_unreachable = True
97100
disallow_any_generics = True
101+
ignore_errors = True
102+
103+
[mypy-google.cloud.bigtable.data.*]
98104
ignore_errors = False
99105

106+
[mypy-google.cloud.bigtable_admin.*]
107+
ignore_errors = True
108+
109+
[mypy-google.cloud.bigtable_admin_v2.*]
110+
ignore_errors = True
111+
112+
[mypy-google.cloud.bigtable_v2.*]
113+
ignore_errors = True
114+
115+
# --- google-cloud-datastore ---
116+
[mypy-google.cloud.datastore.*]
117+
ignore_missing_imports = True
118+
119+
[mypy-google.cloud.datastore._app_engine_key_pb2]
120+
ignore_errors = True
100121

122+
# --- google-cloud-firestore ---
123+
[mypy-google.cloud.firestore.*]
124+
check_untyped_defs = True
125+
126+
# --- google-cloud-pubsub ---
127+
[mypy-google.cloud.pubsub]
128+
ignore_missing_imports = True

packages/google-cloud-bigquery/mypy.ini

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/google-cloud-bigquery/noxfile.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,18 @@
4141
ALL_PYTHON = ["3.10", "3.11", "3.12", "3.13", "3.14"]
4242
UNIT_TEST_PYTHON_VERSIONS = ALL_PYTHON
4343
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
44+
# Path to the centralized mypy configuration file at the repository root.
45+
# Search upwards to support running nox from both monorepo packages and integration test goldens.
46+
MYPY_CONFIG_FILE = next(
47+
(
48+
str(p / "mypy.ini")
49+
for p in CURRENT_DIRECTORY.parents
50+
if (p / "mypy.ini").exists()
51+
),
52+
str(CURRENT_DIRECTORY.parent.parent / "mypy.ini"),
53+
)
54+
55+
4456

4557
SYSTEM_TEST_PYTHON_VERSIONS = UNIT_TEST_PYTHON_VERSIONS
4658

@@ -215,7 +227,15 @@ def mypy(session):
215227
)
216228
session.run("python", "-m", "pip", "freeze")
217229
with log_package_context(session):
218-
session.run("mypy", "-p", "google", "--show-traceback")
230+
session.run(
231+
"mypy",
232+
f"--config-file={MYPY_CONFIG_FILE}",
233+
"-p",
234+
"google",
235+
"--show-traceback",
236+
)
237+
238+
219239

220240

221241
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)

0 commit comments

Comments
 (0)