Skip to content

Commit 4b1121e

Browse files
committed
update post processing to patch noxfile
1 parent e6ee00d commit 4b1121e

1 file changed

Lines changed: 115 additions & 0 deletions

File tree

.librarian/generator-input/client-post-processing/pubsub-integration.yaml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,3 +458,118 @@ replacements:
458458
459459
The last version of this library compatible with Python 2.7 is google-cloud-pubsub==1.7.0.
460460
count: 1
461+
- paths:
462+
- "packages/google-cloud-pubsub/noxfile.py"
463+
before: 'UNIT_TEST_DEPENDENCIES: List\[str\] = \[\]'
464+
after: |-
465+
UNIT_TEST_DEPENDENCIES: List[str] = [
466+
"flaky",
467+
]
468+
count: 1
469+
470+
- paths:
471+
- "packages/google-cloud-pubsub/noxfile.py"
472+
before: 'SYSTEM_TEST_EXTERNAL_DEPENDENCIES: List\[str\] = \[\]'
473+
after: |-
474+
SYSTEM_TEST_EXTERNAL_DEPENDENCIES: List[str] = [
475+
"psutil",
476+
"flaky",
477+
]
478+
count: 1
479+
- paths:
480+
- "packages/google-cloud-pubsub/noxfile.py"
481+
before: 'nox\.options\.sessions = \[\n(?:[ \t]+)"unit",\n(?:[ \t]+)"system",\n(?:[ \t]+)"cover",\n(?:[ \t]+)"lint",\n(?:[ \t]+)"lint_setup_py",\n(?:[ \t]+)"blacken",\n(?:[ \t]+)"docs",\n\]'
482+
after: |-
483+
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
484+
485+
nox.options.sessions = [
486+
"unit",
487+
"system",
488+
"cover",
489+
"lint",
490+
"lint_setup_py",
491+
"blacken",
492+
"mypy",
493+
# https://github.com/googleapis/python-pubsub/pull/552#issuecomment-1016256936
494+
# "mypy_samples", # TODO: uncomment when the check passes
495+
"docs",
496+
"docfx",
497+
"format",
498+
]
499+
count: 1
500+
- paths:
501+
- "packages/google-cloud-pubsub/noxfile.py"
502+
before: '@nox\.session\(python=ALL_PYTHON\)\ndef mypy\(session\):[\s\S]+?(?=\n@nox\.session\ndef update_lower_bounds\(session\):)'
503+
after: |-
504+
MYPY_VERSION = "mypy==1.10.0"
505+
506+
@nox.session(python=DEFAULT_PYTHON_VERSION)
507+
def mypy(session):
508+
"""Run type checks with mypy."""
509+
session.install("-e", ".[all]")
510+
session.install(MYPY_VERSION)
511+
512+
# Version 2.1.1 of google-api-core version is the first type-checked release.
513+
# Version 2.2.0 of google-cloud-core version is the first type-checked release.
514+
session.install(
515+
"google-api-core[grpc]>=2.1.1", "google-cloud-core>=2.2.0", "types-requests"
516+
)
517+
518+
# Just install the type info directly, since "mypy --install-types" might
519+
# require an additional pass.
520+
# Exclude types-protobuf==4.24.0.20240106
521+
# See https://github.com/python/typeshed/issues/11254
522+
session.install("types-protobuf!=4.24.0.20240106", "types-setuptools")
523+
524+
# TODO: Only check the hand-written layer, the generated code does not pass
525+
# mypy checks yet.
526+
# https://github.com/googleapis/gapic-generator-python/issues/1092
527+
# TODO: Re-enable mypy checks once we merge, since incremental checks are failing due to protobuf upgrade
528+
# session.run("mypy", "-p", "google.cloud", "--exclude", "google/pubsub_v1/")
529+
530+
531+
@nox.session(python=DEFAULT_PYTHON_VERSION)
532+
def mypy_samples(session):
533+
"""Run type checks with mypy."""
534+
535+
session.install("-e", ".[all]")
536+
537+
session.install("pytest")
538+
session.install(MYPY_VERSION)
539+
540+
# Just install the type info directly, since "mypy --install-types" might
541+
# require an additional pass.
542+
session.install(
543+
"types-mock", "types-protobuf", "types-setuptools", "types-requests"
544+
)
545+
546+
session.run(
547+
"mypy",
548+
"--config-file",
549+
str(CURRENT_DIRECTORY / "samples" / "snippets" / "mypy.ini"),
550+
"--no-incremental", # Required by warn-unused-configs from mypy.ini to work
551+
"samples/",
552+
)
553+
554+
count: 1
555+
- paths:
556+
- "packages/google-cloud-pubsub/noxfile.py"
557+
before: '# Install all test dependencies, then install this package in-place\.\n\n([ \t]+)# TODO\(https://github\.com/googleapis/gapic-generator-python/issues/2388\):'
558+
after: |-
559+
# Install all test dependencies, then install this package in-place.
560+
561+
\g<1>if session.python in ["3.7", "3.8"]:
562+
\g<1> session.skip(f"Python {session.python} is no longer supported.")
563+
564+
\g<1># TODO(https://github.com/googleapis/gapic-generator-python/issues/2388):
565+
count: 1
566+
- paths:
567+
- "packages/google-cloud-pubsub/noxfile.py"
568+
before: 'def core_deps_from_source\(session, protobuf_implementation\):[\s\S]+?PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,\n[ \t]+},\n[ \t]+\)'
569+
after: |-
570+
def core_deps_from_source(session, protobuf_implementation):
571+
"""
572+
Skipping until Pub/Sub migration is complete.
573+
"""
574+
session.skip("Skipping core_deps_from_source for google-cloud-pubsub.")
575+
count: 1

0 commit comments

Comments
 (0)