Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.
Closed
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
4 changes: 2 additions & 2 deletions .github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
# limitations under the License.
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
digest: sha256:5581906b957284864632cde4e9c51d1cc66b0094990b27e689132fe5cd036046
# created: 2025-03-05
digest: sha256:21c50ac6b72047705ceac7b3c84dca11f771f40b5cdfd8931bf1f446a89274e5
# created: 2025-04-14T15:05:23.836138399Z
80 changes: 79 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

MYPY_VERSION = "mypy==1.10.0"

MYPY_VERSION = "mypy==1.10.0"

DEFAULT_PYTHON_VERSION = "3.8"

UNIT_TEST_PYTHON_VERSIONS: List[str] = [
Expand Down Expand Up @@ -87,6 +89,11 @@
"mypy",
# https://github.com/googleapis/python-pubsub/pull/552#issuecomment-1016256936
# "mypy_samples", # TODO: uncomment when the check passes
"mypy",
# https://github.com/googleapis/python-pubsub/pull/552#issuecomment-1016256936
# "mypy_samples", # TODO: uncomment when the check passes
# https://github.com/googleapis/python-pubsub/pull/552#issuecomment-1016256936
# "mypy_samples", # TODO: uncomment when the check passes
"docs",
"docfx",
"format",
Expand Down Expand Up @@ -143,6 +150,77 @@ def mypy_samples(session):
)


@nox.session(python=DEFAULT_PYTHON_VERSION)
def mypy(session):
"""Run type checks with mypy."""
session.install("-e", ".[all]")
session.install(MYPY_VERSION)

# Version 2.1.1 of google-api-core version is the first type-checked release.
# Version 2.2.0 of google-cloud-core version is the first type-checked release.
session.install(
"google-api-core[grpc]>=2.1.1",
"google-cloud-core>=2.2.0",
)

# Just install the type info directly, since "mypy --install-types" might
# require an additional pass.
# Exclude types-protobuf==4.24.0.20240106
# See https://github.com/python/typeshed/issues/11254
session.install("types-protobuf!=4.24.0.20240106", "types-setuptools")

# TODO: Only check the hand-written layer, the generated code does not pass
# mypy checks yet.
# https://github.com/googleapis/gapic-generator-python/issues/1092
session.run("mypy", "-p", "google.cloud")


@nox.session(python=DEFAULT_PYTHON_VERSION)
def mypy_samples(session):
"""Run type checks with mypy."""

session.install("-e", ".[all]")

session.install("pytest")
session.install(MYPY_VERSION)

# Just install the type info directly, since "mypy --install-types" might
# require an additional pass.
session.install("types-mock", "types-protobuf", "types-setuptools")

session.run(
"mypy",
"--config-file",
str(CURRENT_DIRECTORY / "samples" / "snippets" / "mypy.ini"),
"--no-incremental", # Required by warn-unused-configs from mypy.ini to work
"samples/",
)


@nox.session(python=DEFAULT_PYTHON_VERSION)
def mypy_samples(session):
"""Run type checks with mypy."""

session.install("-e", ".[all]")

session.install("pytest")
session.install(MYPY_VERSION)

# Just install the type info directly, since "mypy --install-types" might
# require an additional pass.
session.install("types-mock", "types-protobuf", "types-setuptools")

session.run(
"mypy",
# https://github.com/googleapis/python-pubsub/pull/552#issuecomment-1016256936
# "mypy_samples", # TODO: uncomment when the check passes
"--config-file",
str(CURRENT_DIRECTORY / "samples" / "snippets" / "mypy.ini"),
"--no-incremental", # Required by warn-unused-configs from mypy.ini to work
"samples/",
)


@nox.session(python=DEFAULT_PYTHON_VERSION)
def lint(session):
"""Run linters.
Expand Down Expand Up @@ -251,7 +329,7 @@ def unit(session, protobuf_implementation):
"py.test",
"--quiet",
f"--junitxml=unit_{session.python}_sponge_log.xml",
"--cov=google/cloud",
"--cov=google/cloud/cloud",
"--cov=tests/unit",
"--cov-append",
"--cov-config=.coveragerc",
Expand Down