Skip to content

Commit ed1de4f

Browse files
chore: install all sample dependencies when type checking samples (#1455)
1 parent a097631 commit ed1de4f

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

google/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
except ImportError:
2222
import pkgutil
2323

24-
__path__ = pkgutil.extend_path(__path__, __name__)
24+
__path__ = pkgutil.extend_path(__path__, __name__) # type: ignore

google/cloud/bigquery/opentelemetry_tracing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
logger = logging.getLogger(__name__)
2020
try:
21-
from opentelemetry import trace
22-
from opentelemetry.instrumentation.utils import http_status_to_status_code
23-
from opentelemetry.trace.status import Status
21+
from opentelemetry import trace # type: ignore
22+
from opentelemetry.instrumentation.utils import http_status_to_status_code # type: ignore
23+
from opentelemetry.trace.status import Status # type: ignore
2424

2525
HAS_OPENTELEMETRY = True
2626
_warned_telemetry = True

noxfile.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,22 @@ def mypy_samples(session):
200200
"""Run type checks with mypy."""
201201
session.install("-e", ".[all]")
202202

203-
session.install("ipython", "pytest")
203+
session.install("pytest")
204+
for requirements_path in CURRENT_DIRECTORY.glob("samples/*/requirements.txt"):
205+
session.install("-r", requirements_path)
204206
session.install(MYPY_VERSION)
205207

206208
# Just install the dependencies' type info directly, since "mypy --install-types"
207209
# might require an additional pass.
208-
session.install("types-mock", "types-pytz")
210+
session.install(
211+
"types-mock",
212+
"types-pytz",
213+
"types-protobuf",
214+
"types-python-dateutil",
215+
"types-requests",
216+
"types-setuptools",
217+
)
218+
209219
session.install("typing-extensions") # for TypedDict in pre-3.8 Python versions
210220

211221
session.run(

samples/mypy.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# Should match DEFAULT_PYTHON_VERSION from root noxfile.py
33
python_version = 3.8
44
exclude = noxfile\.py
5-
strict = True
65
warn_unused_configs = True
76

87
[mypy-google.auth,google.oauth2,geojson,google_auth_oauthlib,IPython.*]

0 commit comments

Comments
 (0)