Skip to content

Commit b464639

Browse files
committed
fix(generator): clean up noxfile.py and include updated goldens
1 parent b5204b3 commit b464639

1 file changed

Lines changed: 35 additions & 11 deletions

File tree

packages/gapic-generator/noxfile.py

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@
3636

3737
showcase_version = os.environ.get("SHOWCASE_VERSION", "0.35.0")
3838
ADS_TEMPLATES = path.join(path.dirname(__file__), "gapic", "ads-templates")
39+
CURRENT_DIRECTORY = Path(__file__).parent.absolute()
40+
# Path to the centralized mypy configuration file at the repository root.
41+
# Search upwards to support running nox from both monorepo packages and integration test goldens.
42+
MYPY_CONFIG_FILE = next(
43+
(
44+
str(p / "mypy.ini")
45+
for p in CURRENT_DIRECTORY.parents
46+
if (p / "mypy.ini").exists()
47+
),
48+
str(CURRENT_DIRECTORY.parent.parent / "mypy.ini"),
49+
)
50+
3951
RUFF_VERSION = "ruff==0.14.14"
4052
LINT_PATHS = ["docs", "gapic", "tests", "test_utils", "noxfile.py", "setup.py"]
4153
# Ruff uses globs for excludes (different from Black's regex)
@@ -181,7 +193,6 @@ def fragment(session, use_ads_templates=False):
181193
"grpcio-tools",
182194
)
183195
session.install("-e", ".")
184-
session.install("-e", "../google-api-core")
185196

186197
# The specific failure is `Plugin output is unparseable`
187198
if session.python == "3.10":
@@ -246,7 +257,6 @@ def showcase_library(
246257

247258
# Install gapic-generator-python
248259
session.install("-e", ".")
249-
session.install("-e", "../google-api-core")
250260

251261
# Install grpcio-tools for protoc
252262
session.install("grpcio-tools")
@@ -382,6 +392,8 @@ def showcase_library(
382392
# Install the library without a constraints file.
383393
session.install("-e", tmp_dir)
384394

395+
session.install("-e", "../google-api-core", "--no-deps")
396+
385397
yield tmp_dir
386398

387399

@@ -606,7 +618,13 @@ def showcase_mypy(
606618
session.chdir(lib)
607619

608620
# Run the tests.
609-
session.run("mypy", "-p", "google", "--check-untyped-defs")
621+
session.run(
622+
"mypy",
623+
f"--config-file={MYPY_CONFIG_FILE}",
624+
"-p",
625+
"google",
626+
"--check-untyped-defs",
627+
)
610628

611629

612630
@nox.session(python=NEWEST_PYTHON)
@@ -732,7 +750,7 @@ def mypy(session):
732750
"click==8.1.3",
733751
)
734752
session.install(".")
735-
session.run("mypy", "-p", "gapic")
753+
session.run("mypy", f"--config-file={MYPY_CONFIG_FILE}", "-p", "gapic")
736754

737755

738756
@nox.session(python=NEWEST_PYTHON)
@@ -744,7 +762,7 @@ def lint(session):
744762
"""
745763

746764
# TODO(https://github.com/googleapis/google-cloud-python/issues/16186):
747-
# SKIP: This session was not enforced in the standalone (split) repo
765+
# SKIP: This session was not enforced in the standalone (split) repo
748766
# and is disabled here to ensure a "move-only" migration.
749767
session.skip(
750768
"Linting was not enforced in the split repo. "
@@ -774,9 +792,11 @@ def lint(session):
774792
@nox.session(python=NEWEST_PYTHON)
775793
def lint_setup_py(session):
776794
# TODO(https://github.com/googleapis/google-cloud-python/issues/16186):
777-
# SKIP: This session was not enforced in the standalone (split) repo
795+
# SKIP: This session was not enforced in the standalone (split) repo
778796
# and is disabled here to ensure a "move-only" migration.
779-
session.skip("Skipping now to avoid changing code during migration. See Issue #16186")
797+
session.skip(
798+
"Skipping now to avoid changing code during migration. See Issue #16186"
799+
)
780800

781801

782802
@nox.session(python="3.10")
@@ -851,9 +871,11 @@ def prerelease_deps(session, protobuf_implementation):
851871
"""
852872
Run all tests with pre-release versions of dependencies installed.
853873
"""
854-
# TODO(https://github.com/googleapis/google-cloud-python/issues/16184):
874+
# TODO(https://github.com/googleapis/google-cloud-python/issues/16184):
855875
# Implement pre-release dependency logic to test against upcoming runtime changes.
856-
session.skip("prerelease_deps session is not yet implemented for gapic-generator-python.")
876+
session.skip(
877+
"prerelease_deps session is not yet implemented for gapic-generator-python."
878+
)
857879

858880

859881
@nox.session(python=NEWEST_PYTHON)
@@ -863,6 +885,8 @@ def prerelease_deps(session, protobuf_implementation):
863885
)
864886
def core_deps_from_source(session, protobuf_implementation):
865887
"""Run all tests with core dependencies installed from source."""
866-
# TODO(https://github.com/googleapis/google-cloud-python/issues/16185):
888+
# TODO(https://github.com/googleapis/google-cloud-python/issues/16185):
867889
# Implement logic to install core packages directly from the mono-repo directories.
868-
session.skip("core_deps_from_source session is not yet implemented for gapic-generator-python.")
890+
session.skip(
891+
"core_deps_from_source session is not yet implemented for gapic-generator-python."
892+
)

0 commit comments

Comments
 (0)