Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -39,42 +39,6 @@ replacements:
"google-cloud-core >= 2.0.0, <3.0.0",
"grpcio >= 1.59.0, < 2.0.0",
count: 1
- paths: [
"packages/google-cloud-datastore/mypy.ini",
]
before: |-
# Performance: reuse results from previous runs to speed up 'nox'
incremental = True
after: |-
# 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
count: 1
- paths: [
"packages/google-cloud-datastore/mypy.ini",
]
before: |
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
after: |
ignore_missing_imports = True
count: 1
- paths: [
"packages/google-cloud-datastore/docs/index.rst",
]
Expand Down
110 changes: 110 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
[mypy]
namespace_packages = True
ignore_missing_imports = False

# 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

exclude = (?x)(
(^|/)third_party/
| (^|/)tests/unit/resources/
| (^|/)tests/unit/gapic/
)
Comment thread
chalmerlowe marked this conversation as resolved.


# ==============================================================================
# GLOBAL THIRD-PARTY & SHARED LIBRARY IGNORES
# ==============================================================================

[mypy-anywidget]
ignore_missing_imports = True

[mypy-cloudpickle.*]
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]
ignore_missing_imports = True

[mypy-google.colab]
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.protobuf.*]
ignore_missing_imports = True

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

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

[mypy-grpc.*]
ignore_missing_imports = True

[mypy-ibis.*]
ignore_missing_imports = True

[mypy-ipywidgets]
ignore_missing_imports = True

[mypy-proto.*]
ignore_missing_imports = True

[mypy-pyarrow.*]
ignore_missing_imports = True

[mypy-pydata_google_auth]
ignore_missing_imports = True

[mypy-pytest]
ignore_missing_imports = True

[mypy-pytz]
ignore_missing_imports = True


# ==============================================================================
# PACKAGE-SPECIFIC OVERRIDES & EXCEPTIONS
# ==============================================================================

# --- google-cloud-bigtable ---
[mypy-google.cloud.bigtable.*]
ignore_errors = True

[mypy-google.cloud.bigtable.data.*]
check_untyped_defs = True
warn_unreachable = True
disallow_any_generics = True
ignore_errors = False

# --- google-cloud-datastore ---
[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

[mypy-google.cloud.datastore_v1.services.datastore.client]
ignore_errors = True
3 changes: 0 additions & 3 deletions packages/gapic-generator/gapic/ads-templates/mypy.ini.j2

This file was deleted.

7 changes: 7 additions & 0 deletions packages/gapic-generator/gapic/ads-templates/noxfile.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
{% block content %}

import os
import pathlib

import nox # type: ignore


CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
# Path to the centralized mypy configuration file at the repository root.
MYPY_CONFIG_FILE = str(CURRENT_DIRECTORY.parent.parent / "mypy.ini")


# TODO(https://github.com/googleapis/gapic-generator-python/issues/2450):
# Add tests for Python 3.15 alpha1
# https://peps.python.org/pep-0790/
Expand Down Expand Up @@ -44,6 +50,7 @@ def mypy(session):
session.install('.')
session.run(
'mypy',
f"--config-file={MYPY_CONFIG_FILE}",
{% if api.naming.module_namespace %}
'{{ api.naming.module_namespace[0] }}',
{% else %}
Expand Down
15 changes: 0 additions & 15 deletions packages/gapic-generator/gapic/templates/mypy.ini.j2

This file was deleted.

3 changes: 3 additions & 0 deletions packages/gapic-generator/gapic/templates/noxfile.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ DEFAULT_PYTHON_VERSION = "3.14"
PREVIEW_PYTHON_VERSION = "3.14"

CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
# Path to the centralized mypy configuration file at the repository root.
MYPY_CONFIG_FILE = str(CURRENT_DIRECTORY.parent.parent / "mypy.ini")

if (CURRENT_DIRECTORY / "testing").exists():
LOWER_BOUND_CONSTRAINTS_FILE = (
Expand Down Expand Up @@ -101,6 +103,7 @@ def mypy(session):
session.install(".")
session.run(
"mypy",
f"--config-file={MYPY_CONFIG_FILE}",
"-p",
{% if api.naming.module_namespace %}
"{{ api.naming.module_namespace[0] }}",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
PREVIEW_PYTHON_VERSION = "3.14"

CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
# Path to the centralized mypy configuration file at the repository root.
MYPY_CONFIG_FILE = str(CURRENT_DIRECTORY.parent.parent / "mypy.ini")

if (CURRENT_DIRECTORY / "testing").exists():
LOWER_BOUND_CONSTRAINTS_FILE = (
Expand Down Expand Up @@ -108,6 +110,7 @@ def mypy(session):
session.install(".")
session.run(
"mypy",
f"--config-file={MYPY_CONFIG_FILE}",
"-p",
"google",
"--check-untyped-defs",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
PREVIEW_PYTHON_VERSION = "3.14"

CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
# Path to the centralized mypy configuration file at the repository root.
MYPY_CONFIG_FILE = str(CURRENT_DIRECTORY.parent.parent / "mypy.ini")

if (CURRENT_DIRECTORY / "testing").exists():
LOWER_BOUND_CONSTRAINTS_FILE = (
Expand Down Expand Up @@ -108,6 +110,7 @@ def mypy(session):
session.install(".")
session.run(
"mypy",
f"--config-file={MYPY_CONFIG_FILE}",
"-p",
"google",
"--check-untyped-defs",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
PREVIEW_PYTHON_VERSION = "3.14"

CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
# Path to the centralized mypy configuration file at the repository root.
MYPY_CONFIG_FILE = str(CURRENT_DIRECTORY.parent.parent / "mypy.ini")

if (CURRENT_DIRECTORY / "testing").exists():
LOWER_BOUND_CONSTRAINTS_FILE = (
Expand Down Expand Up @@ -108,6 +110,7 @@ def mypy(session):
session.install(".")
session.run(
"mypy",
f"--config-file={MYPY_CONFIG_FILE}",
"-p",
"google",
"--check-untyped-defs",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
PREVIEW_PYTHON_VERSION = "3.14"

CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
# Path to the centralized mypy configuration file at the repository root.
MYPY_CONFIG_FILE = str(CURRENT_DIRECTORY.parent.parent / "mypy.ini")

if (CURRENT_DIRECTORY / "testing").exists():
LOWER_BOUND_CONSTRAINTS_FILE = (
Expand Down Expand Up @@ -108,6 +110,7 @@ def mypy(session):
session.install(".")
session.run(
"mypy",
f"--config-file={MYPY_CONFIG_FILE}",
"-p",
"google",
"--check-untyped-defs",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
PREVIEW_PYTHON_VERSION = "3.14"

CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
# Path to the centralized mypy configuration file at the repository root.
MYPY_CONFIG_FILE = str(CURRENT_DIRECTORY.parent.parent / "mypy.ini")

if (CURRENT_DIRECTORY / "testing").exists():
LOWER_BOUND_CONSTRAINTS_FILE = (
Expand Down Expand Up @@ -108,6 +110,7 @@ def mypy(session):
session.install(".")
session.run(
"mypy",
f"--config-file={MYPY_CONFIG_FILE}",
"-p",
"google",
"--check-untyped-defs",
Expand Down

This file was deleted.

Loading
Loading