Skip to content

Commit

Permalink
🦉 Updates from OwlBot post-processor
Browse files Browse the repository at this point in the history
  • Loading branch information
gcf-owl-bot[bot] committed Nov 4, 2024
1 parent 755e943 commit 1d105d8
Showing 1 changed file with 107 additions and 1 deletion.
108 changes: 107 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,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 @@ -92,6 +94,13 @@
# "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
"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
# 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 @@ -219,6 +228,103 @@ 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 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
# 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 @@ -327,7 +433,7 @@ def unit(session, protobuf_implementation):
"py.test",
"--quiet",
f"--junitxml=unit_{session.python}_sponge_log.xml",
"--cov=google/cloud/cloud",
"--cov=google/cloud/cloud/cloud",
"--cov=tests/unit",
"--cov-append",
"--cov-config=.coveragerc",
Expand Down

0 comments on commit 1d105d8

Please sign in to comment.