diff --git a/mypy.ini b/mypy.ini index e36c23ebbc8a..a6f8d17f0ab3 100644 --- a/mypy.ini +++ b/mypy.ini @@ -14,7 +14,6 @@ exclude = (?x)( | (^|/)tests/unit/gapic/ ) - # ============================================================================== # GLOBAL THIRD-PARTY & SHARED LIBRARY IGNORES # ============================================================================== @@ -28,13 +27,7 @@ ignore_missing_imports = True [mypy-flask] ignore_missing_imports = True -[mypy-google.auth.*] -ignore_missing_imports = True - -[mypy-google.cloud.bigtable] -ignore_missing_imports = True - -[mypy-google.cloud.pubsub] +[mypy-google.api.*] ignore_missing_imports = True [mypy-google.colab] @@ -61,6 +54,9 @@ ignore_missing_imports = True [mypy-grpc.*] ignore_missing_imports = True +[mypy-grpc_status] +ignore_missing_imports = True + [mypy-ibis.*] ignore_missing_imports = True @@ -86,15 +82,47 @@ ignore_missing_imports = True # ============================================================================== # PACKAGE-SPECIFIC OVERRIDES & EXCEPTIONS # ============================================================================== +# --- bigframes --- +[mypy-bigframes_vendored.*] +ignore_errors = True + +# --- google-auth --- +[mypy-google.auth.*] +ignore_missing_imports = True # --- google-cloud-bigtable --- -[mypy-google.cloud.bigtable.*] -ignore_errors = True +[mypy-google.cloud.bigtable] +ignore_missing_imports = True -[mypy-google.cloud.bigtable.data.*] +[mypy-google.cloud.bigtable.*] check_untyped_defs = True warn_unreachable = True disallow_any_generics = True +ignore_errors = True + +[mypy-google.cloud.bigtable.data.*] ignore_errors = False +[mypy-google.cloud.bigtable_admin.*] +ignore_errors = True + +[mypy-google.cloud.bigtable_admin_v2.*] +ignore_errors = True + +[mypy-google.cloud.bigtable_v2.*] +ignore_errors = True + +# --- google-cloud-datastore --- +[mypy-google.cloud.datastore.*] +ignore_missing_imports = True + +[mypy-google.cloud.datastore._app_engine_key_pb2] +ignore_errors = True +# --- google-cloud-firestore --- +[mypy-google.cloud.firestore.*] +check_untyped_defs = True + +# --- google-cloud-pubsub --- +[mypy-google.cloud.pubsub] +ignore_missing_imports = True diff --git a/packages/bigquery-magics/mypy.ini b/packages/bigquery-magics/mypy.ini deleted file mode 100644 index a3cb5c292172..000000000000 --- a/packages/bigquery-magics/mypy.ini +++ /dev/null @@ -1,3 +0,0 @@ -[mypy] -python_version = 3.14 -namespace_packages = True diff --git a/packages/bigquery-magics/noxfile.py b/packages/bigquery-magics/noxfile.py index f275406b6905..0ff22a1037e7 100644 --- a/packages/bigquery-magics/noxfile.py +++ b/packages/bigquery-magics/noxfile.py @@ -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", diff --git a/packages/db-dtypes/noxfile.py b/packages/db-dtypes/noxfile.py index b80b1df6832a..afd1ab00a637 100644 --- a/packages/db-dtypes/noxfile.py +++ b/packages/db-dtypes/noxfile.py @@ -70,6 +70,17 @@ 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 = [ @@ -541,6 +552,7 @@ def mypy(session): session.install("-e", ".") session.run( "mypy", + f"--config-file={MYPY_CONFIG_FILE}", "-p", "db_dtypes", "--check-untyped-defs", diff --git a/packages/django-google-spanner/noxfile.py b/packages/django-google-spanner/noxfile.py index 0b94e5b87bff..dfdeaa49f4a1 100644 --- a/packages/django-google-spanner/noxfile.py +++ b/packages/django-google-spanner/noxfile.py @@ -66,6 +66,16 @@ ] 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.session(python=DEFAULT_PYTHON_VERSION) diff --git a/packages/gapic-generator/mypy.ini b/packages/gapic-generator/mypy.ini deleted file mode 100644 index ecb455a69d99..000000000000 --- a/packages/gapic-generator/mypy.ini +++ /dev/null @@ -1,2 +0,0 @@ -[mypy] -python_version = 3.14 diff --git a/packages/gapic-generator/noxfile.py b/packages/gapic-generator/noxfile.py index 6fac5c48853d..a9b1d7fc5bf7 100644 --- a/packages/gapic-generator/noxfile.py +++ b/packages/gapic-generator/noxfile.py @@ -36,6 +36,18 @@ showcase_version = os.environ.get("SHOWCASE_VERSION", "0.35.0") ADS_TEMPLATES = path.join(path.dirname(__file__), "gapic", "ads-templates") +CURRENT_DIRECTORY = 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"), +) + RUFF_VERSION = "ruff==0.14.14" LINT_PATHS = ["docs", "gapic", "tests", "test_utils", "noxfile.py", "setup.py"] # Ruff uses globs for excludes (different from Black's regex) @@ -714,7 +726,7 @@ def mypy(session): "click==8.1.3", ) session.install(".") - session.run("mypy", "-p", "gapic") + session.run("mypy", f"--config-file={MYPY_CONFIG_FILE}", "-p", "gapic") @nox.session(python=NEWEST_PYTHON) @@ -726,7 +738,7 @@ def lint(session): """ # TODO(https://github.com/googleapis/google-cloud-python/issues/16186): - # SKIP: This session was not enforced in the standalone (split) repo + # SKIP: This session was not enforced in the standalone (split) repo # and is disabled here to ensure a "move-only" migration. session.skip( "Linting was not enforced in the split repo. " @@ -756,9 +768,11 @@ def lint(session): @nox.session(python=NEWEST_PYTHON) def lint_setup_py(session): # TODO(https://github.com/googleapis/google-cloud-python/issues/16186): - # SKIP: This session was not enforced in the standalone (split) repo + # SKIP: This session was not enforced in the standalone (split) repo # and is disabled here to ensure a "move-only" migration. - session.skip("Skipping now to avoid changing code during migration. See Issue #16186") + session.skip( + "Skipping now to avoid changing code during migration. See Issue #16186" + ) @nox.session(python="3.10") @@ -833,9 +847,11 @@ def prerelease_deps(session, protobuf_implementation): """ Run all tests with pre-release versions of dependencies installed. """ - # TODO(https://github.com/googleapis/google-cloud-python/issues/16184): + # TODO(https://github.com/googleapis/google-cloud-python/issues/16184): # Implement pre-release dependency logic to test against upcoming runtime changes. - session.skip("prerelease_deps session is not yet implemented for gapic-generator-python.") + session.skip( + "prerelease_deps session is not yet implemented for gapic-generator-python." + ) @nox.session(python=NEWEST_PYTHON) @@ -845,6 +861,8 @@ def prerelease_deps(session, protobuf_implementation): ) def core_deps_from_source(session, protobuf_implementation): """Run all tests with core dependencies installed from source.""" - # TODO(https://github.com/googleapis/google-cloud-python/issues/16185): + # TODO(https://github.com/googleapis/google-cloud-python/issues/16185): # Implement logic to install core packages directly from the mono-repo directories. - session.skip("core_deps_from_source session is not yet implemented for gapic-generator-python.") \ No newline at end of file + session.skip( + "core_deps_from_source session is not yet implemented for gapic-generator-python." + ) diff --git a/packages/gcp-sphinx-docfx-yaml/noxfile.py b/packages/gcp-sphinx-docfx-yaml/noxfile.py index ba5658c0e24f..c83da80f1973 100644 --- a/packages/gcp-sphinx-docfx-yaml/noxfile.py +++ b/packages/gcp-sphinx-docfx-yaml/noxfile.py @@ -13,11 +13,24 @@ # limitations under the License. import os +import pathlib import nox DEFAULT_PYTHON_VERSION = "3.14" UNIT_TEST_PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] +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"), +) + RUFF_VERSION = "ruff==0.14.14" ALL_PYTHON = list(UNIT_TEST_PYTHON_VERSIONS) diff --git a/packages/google-api-core/noxfile.py b/packages/google-api-core/noxfile.py index 0bad668a80dd..c2904cfc0261 100644 --- a/packages/google-api-core/noxfile.py +++ b/packages/google-api-core/noxfile.py @@ -39,6 +39,16 @@ DEFAULT_PYTHON_VERSION = "3.14" 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"), +) # Error if a python version is missing @@ -370,7 +380,7 @@ def mypy(session): "types-requests", "types-protobuf", ) - session.run("mypy", "google", "tests") + session.run("mypy", f"--config-file={MYPY_CONFIG_FILE}", "google", "tests") @nox.session(python=DEFAULT_PYTHON_VERSION) diff --git a/packages/google-auth-httplib2/noxfile.py b/packages/google-auth-httplib2/noxfile.py index 67b1bd420cc5..162301d4f13b 100644 --- a/packages/google-auth-httplib2/noxfile.py +++ b/packages/google-auth-httplib2/noxfile.py @@ -69,6 +69,17 @@ 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"), +) + # Error if a python version is missing nox.options.error_on_missing_interpreters = True @@ -101,6 +112,7 @@ def mypy(session): session.install(".") session.run( "mypy", + f"--config-file={MYPY_CONFIG_FILE}", "google_auth_httplib2.py", ) diff --git a/packages/google-auth-oauthlib/noxfile.py b/packages/google-auth-oauthlib/noxfile.py index a028eb1f1900..1a7f043e7461 100644 --- a/packages/google-auth-oauthlib/noxfile.py +++ b/packages/google-auth-oauthlib/noxfile.py @@ -69,6 +69,17 @@ 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"), +) + # Error if a python version is missing nox.options.error_on_missing_interpreters = True @@ -471,6 +482,7 @@ def mypy(session): session.install(".") session.run( "mypy", + f"--config-file={MYPY_CONFIG_FILE}", "-p", "google_auth_oauthlib", ) diff --git a/packages/google-auth/mypy.ini b/packages/google-auth/mypy.ini deleted file mode 100644 index c129006db138..000000000000 --- a/packages/google-auth/mypy.ini +++ /dev/null @@ -1,3 +0,0 @@ -[mypy] -python_version = 3.9 -namespace_packages = True diff --git a/packages/google-auth/noxfile.py b/packages/google-auth/noxfile.py index 5962f96bf094..a7a2bf17e1de 100644 --- a/packages/google-auth/noxfile.py +++ b/packages/google-auth/noxfile.py @@ -20,6 +20,17 @@ import nox 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"), +) + CLICK_VERSION = "click" BLACK_VERSION = "black==23.7.0" @@ -156,7 +167,16 @@ def mypy(session): "types-mock", "pytest<8.0.0", ) - session.run("mypy", "-p", "google", "-p", "tests", "-p", "tests_async") + session.run( + "mypy", + f"--config-file={MYPY_CONFIG_FILE}", + "-p", + "google", + "-p", + "tests", + "-p", + "tests_async", + ) @nox.session(python=ALL_PYTHON) diff --git a/packages/google-cloud-bigquery/mypy.ini b/packages/google-cloud-bigquery/mypy.ini deleted file mode 100644 index a3cb5c292172..000000000000 --- a/packages/google-cloud-bigquery/mypy.ini +++ /dev/null @@ -1,3 +0,0 @@ -[mypy] -python_version = 3.14 -namespace_packages = True diff --git a/packages/google-cloud-bigquery/noxfile.py b/packages/google-cloud-bigquery/noxfile.py index c1dd1692b744..d4accfea91a4 100644 --- a/packages/google-cloud-bigquery/noxfile.py +++ b/packages/google-cloud-bigquery/noxfile.py @@ -41,6 +41,17 @@ ALL_PYTHON = ["3.10", "3.11", "3.12", "3.13", "3.14"] UNIT_TEST_PYTHON_VERSIONS = ALL_PYTHON 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"), +) + SYSTEM_TEST_PYTHON_VERSIONS = UNIT_TEST_PYTHON_VERSIONS @@ -215,7 +226,13 @@ def mypy(session): ) session.run("python", "-m", "pip", "freeze") with log_package_context(session): - session.run("mypy", "-p", "google", "--show-traceback") + session.run( + "mypy", + f"--config-file={MYPY_CONFIG_FILE}", + "-p", + "google", + "--show-traceback", + ) @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) diff --git a/packages/google-cloud-bigtable/mypy.ini b/packages/google-cloud-bigtable/mypy.ini deleted file mode 100644 index 701b7587ce6f..000000000000 --- a/packages/google-cloud-bigtable/mypy.ini +++ /dev/null @@ -1,38 +0,0 @@ -[mypy] -python_version = 3.13 -namespace_packages = True -check_untyped_defs = True -warn_unreachable = True -disallow_any_generics = True -exclude = tests/unit/gapic/ - -[mypy-grpc.*] -ignore_missing_imports = True - -[mypy-google.auth.*] -ignore_missing_imports = True - -[mypy-google.iam.*] -ignore_missing_imports = True - -[mypy-google.longrunning.*] -ignore_missing_imports = True - -[mypy-google.oauth2.*] -ignore_missing_imports = True - -[mypy-google.rpc.*] -ignore_missing_imports = True - -[mypy-proto.*] -ignore_missing_imports = True - -[mypy-pytest] -ignore_missing_imports = True - -[mypy-google.cloud.*] -ignore_errors = True - -# only verify data client -[mypy-google.cloud.bigtable.data.*] -ignore_errors = False diff --git a/packages/google-cloud-bigtable/noxfile.py b/packages/google-cloud-bigtable/noxfile.py index e6ef8c1e9911..25b94d7b6ab4 100644 --- a/packages/google-cloud-bigtable/noxfile.py +++ b/packages/google-cloud-bigtable/noxfile.py @@ -66,6 +66,17 @@ 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 = [ @@ -175,7 +186,9 @@ def mypy(session): "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) diff --git a/packages/google-cloud-core/mypy.ini b/packages/google-cloud-core/mypy.ini deleted file mode 100644 index ed9dccd3b6fd..000000000000 --- a/packages/google-cloud-core/mypy.ini +++ /dev/null @@ -1,7 +0,0 @@ -[mypy] -python_version = 3.14 -namespace_packages = True -ignore_missing_imports = True - -[mypy-google.protobuf] -ignore_missing_imports = True diff --git a/packages/google-cloud-core/noxfile.py b/packages/google-cloud-core/noxfile.py index 2de40dfb9234..a86e71252c69 100644 --- a/packages/google-cloud-core/noxfile.py +++ b/packages/google-cloud-core/noxfile.py @@ -15,6 +15,7 @@ from __future__ import absolute_import import os +import pathlib import re import shutil @@ -32,7 +33,17 @@ "3.13", "3.14", ] -CURRENT_DIRECTORY = os.path.abspath(os.path.dirname(__file__)) +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"), +) # Error if a python version is missing nox.options.error_on_missing_interpreters = True @@ -62,7 +73,14 @@ def mypy(session): "types-mock", "types-protobuf!=4.24.0.20240106", ) - session.run("mypy", "-p", "google", "-p", "tests") + session.run( + "mypy", + f"--config-file={MYPY_CONFIG_FILE}", + "-p", + "google", + "-p", + "tests", + ) @nox.session(python=DEFAULT_PYTHON_VERSION) diff --git a/packages/google-cloud-datastore/mypy.ini b/packages/google-cloud-datastore/mypy.ini deleted file mode 100644 index 2d553926db9d..000000000000 --- a/packages/google-cloud-datastore/mypy.ini +++ /dev/null @@ -1,23 +0,0 @@ -[mypy] -python_version = 3.14 -namespace_packages = True -ignore_missing_imports = True - -# Helps mypy navigate the 'google' namespace more reliably in 3.10+ -explicit_package_bases = True - -# Performance: reuse results from previous runs to speed up "nox" -incremental = True - -[mypy-google.cloud.datastore._app_engine_key_pb2] -ignore_errors = True - -# TODO(https://github.com/googleapis/gapic-generator-python/issues/2410): -# Remove once this generator bug is fixed -[mypy-google.cloud.datastore_v1.services.datastore.async_client] -ignore_errors = True - -# TODO(https://github.com/googleapis/gapic-generator-python/issues/2410): -# Remove once this generator bug is fixed -[mypy-google.cloud.datastore_v1.services.datastore.client] -ignore_errors = True diff --git a/packages/google-cloud-datastore/noxfile.py b/packages/google-cloud-datastore/noxfile.py index af42d740478e..d803e9759965 100644 --- a/packages/google-cloud-datastore/noxfile.py +++ b/packages/google-cloud-datastore/noxfile.py @@ -46,6 +46,17 @@ PREVIEW_PYTHON_VERSION = "3.14" 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"), +) + if (CURRENT_DIRECTORY / "testing").exists(): LOWER_BOUND_CONSTRAINTS_FILE = ( @@ -107,6 +118,7 @@ def mypy(session): session.install(".") session.run( "mypy", + f"--config-file={MYPY_CONFIG_FILE}", "-p", "google", # TODO(https://github.com/googleapis/google-cloud-python/issues/16083) diff --git a/packages/google-cloud-dns/noxfile.py b/packages/google-cloud-dns/noxfile.py index bb38d1e08a91..55c042e6b68f 100644 --- a/packages/google-cloud-dns/noxfile.py +++ b/packages/google-cloud-dns/noxfile.py @@ -67,6 +67,17 @@ 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"), +) + nox.options.sessions = [ "unit-3.10", @@ -155,6 +166,7 @@ def mypy(session): session.install(".") session.run( "mypy", + f"--config-file={MYPY_CONFIG_FILE}", "-p", "google", ) diff --git a/packages/google-cloud-documentai-toolbox/noxfile.py b/packages/google-cloud-documentai-toolbox/noxfile.py index db70716c5d6b..d046a6f3d39b 100644 --- a/packages/google-cloud-documentai-toolbox/noxfile.py +++ b/packages/google-cloud-documentai-toolbox/noxfile.py @@ -69,6 +69,17 @@ 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"), +) + nox.options.sessions = [ "unit-3.10", @@ -498,6 +509,7 @@ def mypy(session): session.install("-e", ".") session.run( "mypy", + f"--config-file={MYPY_CONFIG_FILE}", "-p", "google.cloud.documentai_toolbox", "--check-untyped-defs", diff --git a/packages/google-cloud-error-reporting/mypy.ini b/packages/google-cloud-error-reporting/mypy.ini deleted file mode 100644 index e0e0da2e9e40..000000000000 --- a/packages/google-cloud-error-reporting/mypy.ini +++ /dev/null @@ -1,15 +0,0 @@ -[mypy] -python_version = 3.14 -namespace_packages = True -ignore_missing_imports = False - -# TODO(https://github.com/googleapis/gapic-generator-python/issues/2563): -# Dependencies that historically lacks py.typed markers -[mypy-google.iam.*] -ignore_missing_imports = True - -# Helps mypy navigate the 'google' namespace more reliably in 3.10+ -explicit_package_bases = True - -# Performance: reuse results from previous runs to speed up 'nox' -incremental = True diff --git a/packages/google-cloud-error-reporting/noxfile.py b/packages/google-cloud-error-reporting/noxfile.py index e13108291d94..9c99c1dbc424 100644 --- a/packages/google-cloud-error-reporting/noxfile.py +++ b/packages/google-cloud-error-reporting/noxfile.py @@ -46,6 +46,17 @@ PREVIEW_PYTHON_VERSION = "3.14" 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"), +) + if (CURRENT_DIRECTORY / "testing").exists(): LOWER_BOUND_CONSTRAINTS_FILE = ( @@ -107,6 +118,7 @@ def mypy(session): session.install(".") session.run( "mypy", + f"--config-file={MYPY_CONFIG_FILE}", "-p", "google", # TODO(https://github.com/googleapis/google-cloud-python/issues/16083) diff --git a/packages/google-cloud-firestore/mypy.ini b/packages/google-cloud-firestore/mypy.ini deleted file mode 100644 index e0e0da2e9e40..000000000000 --- a/packages/google-cloud-firestore/mypy.ini +++ /dev/null @@ -1,15 +0,0 @@ -[mypy] -python_version = 3.14 -namespace_packages = True -ignore_missing_imports = False - -# TODO(https://github.com/googleapis/gapic-generator-python/issues/2563): -# Dependencies that historically lacks py.typed markers -[mypy-google.iam.*] -ignore_missing_imports = True - -# Helps mypy navigate the 'google' namespace more reliably in 3.10+ -explicit_package_bases = True - -# Performance: reuse results from previous runs to speed up 'nox' -incremental = True diff --git a/packages/google-cloud-firestore/noxfile.py b/packages/google-cloud-firestore/noxfile.py index 4df37240719c..56ef7dcac0d5 100644 --- a/packages/google-cloud-firestore/noxfile.py +++ b/packages/google-cloud-firestore/noxfile.py @@ -46,6 +46,17 @@ PREVIEW_PYTHON_VERSION = "3.14" 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"), +) + if (CURRENT_DIRECTORY / "testing").exists(): LOWER_BOUND_CONSTRAINTS_FILE = ( @@ -166,9 +177,9 @@ def mypy(session): session.install(".") session.run( "mypy", + f"--config-file={MYPY_CONFIG_FILE}", "-p", "google", - "--check-untyped-defs", *session.posargs, ) diff --git a/packages/google-cloud-logging/mypy.ini b/packages/google-cloud-logging/mypy.ini deleted file mode 100644 index e0e0da2e9e40..000000000000 --- a/packages/google-cloud-logging/mypy.ini +++ /dev/null @@ -1,15 +0,0 @@ -[mypy] -python_version = 3.14 -namespace_packages = True -ignore_missing_imports = False - -# TODO(https://github.com/googleapis/gapic-generator-python/issues/2563): -# Dependencies that historically lacks py.typed markers -[mypy-google.iam.*] -ignore_missing_imports = True - -# Helps mypy navigate the 'google' namespace more reliably in 3.10+ -explicit_package_bases = True - -# Performance: reuse results from previous runs to speed up 'nox' -incremental = True diff --git a/packages/google-cloud-logging/noxfile.py b/packages/google-cloud-logging/noxfile.py index f243539c2d21..2f8d10e8342f 100644 --- a/packages/google-cloud-logging/noxfile.py +++ b/packages/google-cloud-logging/noxfile.py @@ -46,6 +46,17 @@ PREVIEW_PYTHON_VERSION = "3.14" 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"), +) + if (CURRENT_DIRECTORY / "testing").exists(): LOWER_BOUND_CONSTRAINTS_FILE = ( diff --git a/packages/google-cloud-ndb/noxfile.py b/packages/google-cloud-ndb/noxfile.py index e447badd711c..93564ffa28e0 100644 --- a/packages/google-cloud-ndb/noxfile.py +++ b/packages/google-cloud-ndb/noxfile.py @@ -31,6 +31,17 @@ DEFAULT_INTERPRETER = "3.14" ALL_INTERPRETERS = ("3.10", "3.11", "3.12", "3.13", "3.14") 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"), +) + BLACK_VERSION = "black[jupyter]==23.7.0" RUFF_VERSION = "ruff==0.14.14" @@ -535,6 +546,7 @@ def mypy(session): session.install("-e", ".") session.run( "mypy", + f"--config-file={MYPY_CONFIG_FILE}", "-p", "google.cloud.ndb", "--check-untyped-defs", diff --git a/packages/google-cloud-pubsub/mypy.ini b/packages/google-cloud-pubsub/mypy.ini deleted file mode 100644 index e0e0da2e9e40..000000000000 --- a/packages/google-cloud-pubsub/mypy.ini +++ /dev/null @@ -1,15 +0,0 @@ -[mypy] -python_version = 3.14 -namespace_packages = True -ignore_missing_imports = False - -# TODO(https://github.com/googleapis/gapic-generator-python/issues/2563): -# Dependencies that historically lacks py.typed markers -[mypy-google.iam.*] -ignore_missing_imports = True - -# Helps mypy navigate the 'google' namespace more reliably in 3.10+ -explicit_package_bases = True - -# Performance: reuse results from previous runs to speed up 'nox' -incremental = True diff --git a/packages/google-cloud-pubsub/noxfile.py b/packages/google-cloud-pubsub/noxfile.py index fb01bc8d1105..f6f697a38073 100644 --- a/packages/google-cloud-pubsub/noxfile.py +++ b/packages/google-cloud-pubsub/noxfile.py @@ -86,6 +86,17 @@ 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"), +) + nox.options.sessions = [ "unit", @@ -133,7 +144,7 @@ def mypy(session): # 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) diff --git a/packages/google-cloud-runtimeconfig/noxfile.py b/packages/google-cloud-runtimeconfig/noxfile.py index 42e77572607e..f4e52787ebf7 100644 --- a/packages/google-cloud-runtimeconfig/noxfile.py +++ b/packages/google-cloud-runtimeconfig/noxfile.py @@ -68,6 +68,17 @@ 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"), +) + # Error if a python version is missing nox.options.error_on_missing_interpreters = True @@ -100,6 +111,7 @@ def mypy(session): session.install(".") session.run( "mypy", + f"--config-file={MYPY_CONFIG_FILE}", "-p", "google", ) diff --git a/packages/google-cloud-spanner-dbapi-driver/mypy.ini b/packages/google-cloud-spanner-dbapi-driver/mypy.ini deleted file mode 100644 index 81b11c94badc..000000000000 --- a/packages/google-cloud-spanner-dbapi-driver/mypy.ini +++ /dev/null @@ -1,15 +0,0 @@ -[mypy] -python_version = 3.11 -namespace_packages = True -ignore_missing_imports = False - -# TODO(https://github.com/googleapis/gapic-generator-python/issues/2563): -# Dependencies that historically lacks py.typed markers -[mypy-google.iam.*] -ignore_missing_imports = True - -# Helps mypy navigate the 'google' namespace more reliably in 3.10+ -explicit_package_bases = True - -# Performance: reuse results from previous runs to speed up 'nox' -incremental = True diff --git a/packages/google-cloud-spanner-dbapi-driver/noxfile.py b/packages/google-cloud-spanner-dbapi-driver/noxfile.py index 2fedee7ee5af..6eb00ef8a6b6 100644 --- a/packages/google-cloud-spanner-dbapi-driver/noxfile.py +++ b/packages/google-cloud-spanner-dbapi-driver/noxfile.py @@ -53,6 +53,17 @@ PREVIEW_PYTHON_VERSION = "3.14" 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"), +) + LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt" PACKAGE_NAME = "google-cloud-spanner-dbapi-driver" @@ -115,6 +126,7 @@ def mypy(session): session.install(".") session.run( "mypy", + f"--config-file={MYPY_CONFIG_FILE}", "-p", "google", ) diff --git a/packages/google-cloud-spanner/mypy.ini b/packages/google-cloud-spanner/mypy.ini deleted file mode 100644 index e0e0da2e9e40..000000000000 --- a/packages/google-cloud-spanner/mypy.ini +++ /dev/null @@ -1,15 +0,0 @@ -[mypy] -python_version = 3.14 -namespace_packages = True -ignore_missing_imports = False - -# TODO(https://github.com/googleapis/gapic-generator-python/issues/2563): -# Dependencies that historically lacks py.typed markers -[mypy-google.iam.*] -ignore_missing_imports = True - -# Helps mypy navigate the 'google' namespace more reliably in 3.10+ -explicit_package_bases = True - -# Performance: reuse results from previous runs to speed up 'nox' -incremental = True diff --git a/packages/google-cloud-spanner/noxfile.py b/packages/google-cloud-spanner/noxfile.py index fa74716b8142..7dcb31b45ed7 100644 --- a/packages/google-cloud-spanner/noxfile.py +++ b/packages/google-cloud-spanner/noxfile.py @@ -69,6 +69,17 @@ 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"), +) + nox.options.sessions = [ "unit-3.10", @@ -767,6 +778,7 @@ def mypy(session): session.install(".") session.run( "mypy", + f"--config-file={MYPY_CONFIG_FILE}", "-p", "google", # "--check-untyped-defs", diff --git a/packages/google-cloud-storage/mypy.ini b/packages/google-cloud-storage/mypy.ini deleted file mode 100644 index e0e0da2e9e40..000000000000 --- a/packages/google-cloud-storage/mypy.ini +++ /dev/null @@ -1,15 +0,0 @@ -[mypy] -python_version = 3.14 -namespace_packages = True -ignore_missing_imports = False - -# TODO(https://github.com/googleapis/gapic-generator-python/issues/2563): -# Dependencies that historically lacks py.typed markers -[mypy-google.iam.*] -ignore_missing_imports = True - -# Helps mypy navigate the 'google' namespace more reliably in 3.10+ -explicit_package_bases = True - -# Performance: reuse results from previous runs to speed up 'nox' -incremental = True diff --git a/packages/google-cloud-storage/noxfile.py b/packages/google-cloud-storage/noxfile.py index 6e8d41c60b3d..18ef45502ca8 100644 --- a/packages/google-cloud-storage/noxfile.py +++ b/packages/google-cloud-storage/noxfile.py @@ -46,6 +46,17 @@ PREVIEW_PYTHON_VERSION = "3.14" 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"), +) + if (CURRENT_DIRECTORY / "testing").exists(): LOWER_BOUND_CONSTRAINTS_FILE = ( diff --git a/packages/google-cloud-testutils/mypy.ini b/packages/google-cloud-testutils/mypy.ini deleted file mode 100644 index 569486a9ce60..000000000000 --- a/packages/google-cloud-testutils/mypy.ini +++ /dev/null @@ -1,3 +0,0 @@ -[mypy] -python_version = 3.10 -exclude = tests/unit/resources/ diff --git a/packages/google-cloud-testutils/noxfile.py b/packages/google-cloud-testutils/noxfile.py index 0e86a298190e..caebbf8ef459 100644 --- a/packages/google-cloud-testutils/noxfile.py +++ b/packages/google-cloud-testutils/noxfile.py @@ -39,6 +39,16 @@ RUFF_VERSION = "ruff==0.14.14" BLACK_PATHS = ["test_utils", "setup.py"] 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.session(python=DEFAULT_PYTHON_VERSION) @@ -80,8 +90,10 @@ def format(session): # 2. Run Ruff to fix imports session.run( - "ruff", "check", - "--select", "I", + "ruff", + "check", + "--select", + "I", "--fix", f"--target-version=py{ALL_PYTHON[0].replace('.', '')}", "--line-length=88", @@ -90,7 +102,8 @@ def format(session): # 3. Run Ruff to format code session.run( - "ruff", "format", + "ruff", + "format", f"--target-version=py{ALL_PYTHON[0].replace('.', '')}", "--line-length=88", *BLACK_PATHS, @@ -113,7 +126,7 @@ def mypy(session): "types-mock", "types-setuptools", ) - session.run("mypy", "test_utils/", "tests/") + session.run("mypy", f"--config-file={MYPY_CONFIG_FILE}", "test_utils/", "tests/") @nox.session(python=ALL_PYTHON) @@ -328,14 +341,12 @@ def prerelease_deps(session): ) - @nox.session(python=DEFAULT_PYTHON_VERSION) def core_deps_from_source(session): """Run all tests with core dependencies installed from source rather than pulling the dependencies from PyPI. """ - # Install all dependencies constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" diff --git a/packages/google-resumable-media/mypy.ini b/packages/google-resumable-media/mypy.ini deleted file mode 100644 index 4505b485436b..000000000000 --- a/packages/google-resumable-media/mypy.ini +++ /dev/null @@ -1,3 +0,0 @@ -[mypy] -python_version = 3.6 -namespace_packages = True diff --git a/packages/google-resumable-media/noxfile.py b/packages/google-resumable-media/noxfile.py index a1c1ae199709..6d0f35f30375 100644 --- a/packages/google-resumable-media/noxfile.py +++ b/packages/google-resumable-media/noxfile.py @@ -21,6 +21,17 @@ import nox 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"), +) + SYSTEM_TEST_ENV_VARS = ("GOOGLE_APPLICATION_CREDENTIALS",) RUFF_VERSION = "ruff==0.14.14" @@ -68,7 +79,7 @@ def unit(session): line_coverage, os.path.join("tests", "unit"), os.path.join("tests_async", "unit"), - *session.posargs + *session.posargs, ) @@ -106,6 +117,7 @@ def docs(session): os.path.join("docs", "_build", "html", ""), ) + @nox.session(python="3.10") def docfx(session): """Build the docfx yaml files for this library.""" @@ -251,7 +263,16 @@ def mypy(session): "types-requests", "types-mock", ) - session.run("mypy", "-p", "google", "-p", "tests", "-p", "tests_async") + session.run( + "mypy", + f"--config-file={MYPY_CONFIG_FILE}", + "-p", + "google", + "-p", + "tests", + "-p", + "tests_async", + ) @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) @@ -319,7 +340,9 @@ def prerelease_deps(session): # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. with open( - CURRENT_DIRECTORY / "testing" / f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt", + CURRENT_DIRECTORY + / "testing" + / f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt", encoding="utf-8", ) as constraints_file: constraints_text = constraints_file.read() @@ -400,7 +423,9 @@ def core_deps_from_source(session): # version, the first version we test with in the unit tests sessions has a # constraints file containing all dependencies and extras. with open( - CURRENT_DIRECTORY / "testing" / f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt", + CURRENT_DIRECTORY + / "testing" + / f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt", encoding="utf-8", ) as constraints_file: constraints_text = constraints_file.read() @@ -431,7 +456,9 @@ def core_deps_from_source(session): dep_paths = [str(deps_dir / dep) for dep in core_dependencies_from_source] session.install(*dep_paths, "--no-deps", "--ignore-installed") - print(f"Installed {', '.join(core_dependencies_from_source)} locally from {deps_dir}") + print( + f"Installed {', '.join(core_dependencies_from_source)} locally from {deps_dir}" + ) other_deps = [ "cryptography", diff --git a/packages/pandas-gbq/noxfile.py b/packages/pandas-gbq/noxfile.py index 8e58d09628bc..aabc6426becb 100644 --- a/packages/pandas-gbq/noxfile.py +++ b/packages/pandas-gbq/noxfile.py @@ -79,6 +79,17 @@ SYSTEM_TEST_EXTRAS_BY_PYTHON = {} 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"), +) + # Error if a python version is missing nox.options.error_on_missing_interpreters = True @@ -544,6 +555,7 @@ def mypy(session): session.install(".") session.run( "mypy", + f"--config-file={MYPY_CONFIG_FILE}", "pandas_gbq", "--check-untyped-defs", *session.posargs, diff --git a/packages/proto-plus/noxfile.py b/packages/proto-plus/noxfile.py index 4e07083cd49c..5ae48e61efd3 100644 --- a/packages/proto-plus/noxfile.py +++ b/packages/proto-plus/noxfile.py @@ -27,6 +27,17 @@ LINT_PATHS = ["docs", "proto", "tests", "noxfile.py", "setup.py"] 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"), +) + DEFAULT_PYTHON_VERSION = "3.14" diff --git a/packages/sqlalchemy-bigquery/noxfile.py b/packages/sqlalchemy-bigquery/noxfile.py index b1e6b068c872..0588ec4893e2 100644 --- a/packages/sqlalchemy-bigquery/noxfile.py +++ b/packages/sqlalchemy-bigquery/noxfile.py @@ -119,6 +119,16 @@ } 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"), +) def _calculate_duration(func): diff --git a/packages/sqlalchemy-spanner/noxfile.py b/packages/sqlalchemy-spanner/noxfile.py index 187d4e7e8924..7670ac29f936 100644 --- a/packages/sqlalchemy-spanner/noxfile.py +++ b/packages/sqlalchemy-spanner/noxfile.py @@ -82,6 +82,17 @@ class = StreamHandler RUFF_VERSION = "ruff==0.14.14" LINT_PATHS = ["google", "tests", "noxfile.py", "setup.py", "samples"] 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"), +) + UNIT_TEST_STANDARD_DEPENDENCIES = [ "mock", "pytest",