diff --git a/google/__init__.py b/google/__init__.py index 8fcc60e2b..8e60d8439 100644 --- a/google/__init__.py +++ b/google/__init__.py @@ -21,4 +21,4 @@ except ImportError: import pkgutil - __path__ = pkgutil.extend_path(__path__, __name__) + __path__ = pkgutil.extend_path(__path__, __name__) # type: ignore diff --git a/google/cloud/bigquery/opentelemetry_tracing.py b/google/cloud/bigquery/opentelemetry_tracing.py index 2345fd1bb..3d0a66ba8 100644 --- a/google/cloud/bigquery/opentelemetry_tracing.py +++ b/google/cloud/bigquery/opentelemetry_tracing.py @@ -18,9 +18,9 @@ logger = logging.getLogger(__name__) try: - from opentelemetry import trace - from opentelemetry.instrumentation.utils import http_status_to_status_code - from opentelemetry.trace.status import Status + from opentelemetry import trace # type: ignore + from opentelemetry.instrumentation.utils import http_status_to_status_code # type: ignore + from opentelemetry.trace.status import Status # type: ignore HAS_OPENTELEMETRY = True _warned_telemetry = True diff --git a/noxfile.py b/noxfile.py index a91e60a5f..139093acc 100644 --- a/noxfile.py +++ b/noxfile.py @@ -200,12 +200,22 @@ def mypy_samples(session): """Run type checks with mypy.""" session.install("-e", ".[all]") - session.install("ipython", "pytest") + session.install("pytest") + for requirements_path in CURRENT_DIRECTORY.glob("samples/*/requirements.txt"): + session.install("-r", requirements_path) session.install(MYPY_VERSION) # Just install the dependencies' type info directly, since "mypy --install-types" # might require an additional pass. - session.install("types-mock", "types-pytz") + session.install( + "types-mock", + "types-pytz", + "types-protobuf", + "types-python-dateutil", + "types-requests", + "types-setuptools", + ) + session.install("typing-extensions") # for TypedDict in pre-3.8 Python versions session.run( diff --git a/samples/mypy.ini b/samples/mypy.ini index 29757e47d..3f7eb6647 100644 --- a/samples/mypy.ini +++ b/samples/mypy.ini @@ -2,7 +2,6 @@ # Should match DEFAULT_PYTHON_VERSION from root noxfile.py python_version = 3.8 exclude = noxfile\.py -strict = True warn_unused_configs = True [mypy-google.auth,google.oauth2,geojson,google_auth_oauthlib,IPython.*]