Skip to content
Merged
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:25de45b58e52021d3a24a6273964371a97a4efeefe6ad3845a64e697c63b6447
# created: 2025-04-14T14:34:43.260858345Z
92 changes: 1 addition & 91 deletions owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@
if count < 1:
raise Exception(".coveragerc replacement failed.")

s.move([library], excludes=["**/gapic_version.py", "README.rst", "docs/**/*", "setup.py", "testing/constraints-3.7.txt", "testing/constraints-3.8.txt"])
s.move([library], excludes=["**/gapic_version.py", "noxfile.py", "README.rst", "docs/**/*", "setup.py", "testing/constraints-3.7.txt", "testing/constraints-3.8.txt"])
s.remove_staging_dirs()

# ----------------------------------------------------------------------------
Expand All @@ -345,96 +345,6 @@
)
s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml", "README.rst", "docs/index.rst"])

# ----------------------------------------------------------------------------
# Add mypy nox session.
# ----------------------------------------------------------------------------
s.replace(
"noxfile.py",
r"LINT_PATHS = \[.*?\]",
'\g<0>\n\nMYPY_VERSION = "mypy==1.10.0"',
)
s.replace(
"noxfile.py", r'"blacken",', '\g<0>\n "mypy",',
)
s.replace(
"noxfile.py",
r"nox\.options\.error_on_missing_interpreters = True",
textwrap.dedent(
''' \g<0>


@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")'''
),
)


# ----------------------------------------------------------------------------
# Add mypy_samples nox session.
# ----------------------------------------------------------------------------
s.replace(
"noxfile.py",
r' "mypy",',
'\g<0>\n # https://github.com/googleapis/python-pubsub/pull/552#issuecomment-1016256936'
'\n # "mypy_samples", # TODO: uncomment when the check passes',
)
s.replace(
"noxfile.py",
r'session\.run\("mypy", "-p", "google.cloud"\)',
textwrap.dedent(
''' \g<0>


@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/",
)'''
),
)


# Only consider the hand-written layer when assessing the test coverage.
s.replace(
"noxfile.py", "--cov=google", "--cov=google/cloud",
)

s.replace(".github/blunderbuss.yml", "googleapis/api-pubsub", "mukund-ananthu")

python.py_samples(skip_readmes=True)
Expand Down