Skip to content

Commit 68a0bdf

Browse files
committed
fix(ci): fix bazel integration tests and lint formatting
1 parent a7d2363 commit 68a0bdf

418 files changed

Lines changed: 1768 additions & 18371 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/bigframes/noxfile.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"3.10",
4545
# colab.research.google.com
4646
"3.11",
47+
"import_profile",
4748
]
4849

4950
PYTEST_VERSION = "pytest==8.4.2"
@@ -1108,27 +1109,7 @@ def import_profile(session):
11081109
"python",
11091110
str(profiler_script),
11101111
"--module",
1111-
"unknown_module",
1112-
"--iterations",
1113-
"10",
1114-
)
1115-
1116-
1117-
@nox.session(python="3.15")
1118-
def import_profile(session):
1119-
"""Ensure import times remain below defined thresholds."""
1120-
profiler_script = (
1121-
CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
1122-
)
1123-
if not profiler_script.exists():
1124-
session.skip("The import profiler script was not found.")
1125-
1126-
session.install(".")
1127-
session.run(
1128-
"python",
1129-
str(profiler_script),
1130-
"--module",
1131-
"unknown_module",
1112+
"google",
11321113
"--iterations",
11331114
"10",
11341115
)

packages/bigquery-magics/noxfile.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"3.12",
4242
"3.13",
4343
"3.14",
44+
"import_profile",
4445
]
4546

4647
UNIT_TEST_STANDARD_DEPENDENCIES = [
@@ -562,27 +563,7 @@ def import_profile(session):
562563
"python",
563564
str(profiler_script),
564565
"--module",
565-
"unknown_module",
566-
"--iterations",
567-
"10",
568-
)
569-
570-
571-
@nox.session(python="3.15")
572-
def import_profile(session):
573-
"""Ensure import times remain below defined thresholds."""
574-
profiler_script = (
575-
CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
576-
)
577-
if not profiler_script.exists():
578-
session.skip("The import profiler script was not found.")
579-
580-
session.install(".")
581-
session.run(
582-
"python",
583-
str(profiler_script),
584-
"--module",
585-
"unknown_module",
566+
"google",
586567
"--iterations",
587568
"10",
588569
)

packages/db-dtypes/noxfile.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"3.12",
4343
"3.13",
4444
"3.14",
45+
"import_profile",
4546
]
4647

4748
UNIT_TEST_STANDARD_DEPENDENCIES = [
@@ -560,20 +561,10 @@ def import_profile(session):
560561

561562
session.install(".")
562563
session.run(
563-
"python", str(profiler_script), "--module", "db_dtypes", "--iterations", "10"
564-
)
565-
566-
567-
@nox.session(python="3.15")
568-
def import_profile(session):
569-
"""Ensure import times remain below defined thresholds."""
570-
profiler_script = (
571-
CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
572-
)
573-
if not profiler_script.exists():
574-
session.skip("The import profiler script was not found.")
575-
576-
session.install(".")
577-
session.run(
578-
"python", str(profiler_script), "--module", "db_dtypes", "--iterations", "10"
564+
"python",
565+
str(profiler_script),
566+
"--module",
567+
"google",
568+
"--iterations",
569+
"10",
579570
)

packages/django-google-spanner/noxfile.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -507,27 +507,7 @@ def import_profile(session):
507507
"python",
508508
str(profiler_script),
509509
"--module",
510-
"unknown_module",
511-
"--iterations",
512-
"10",
513-
)
514-
515-
516-
@nox.session(python="3.15")
517-
def import_profile(session):
518-
"""Ensure import times remain below defined thresholds."""
519-
profiler_script = (
520-
CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
521-
)
522-
if not profiler_script.exists():
523-
session.skip("The import profiler script was not found.")
524-
525-
session.install(".")
526-
session.run(
527-
"python",
528-
str(profiler_script),
529-
"--module",
530-
"unknown_module",
510+
"google",
531511
"--iterations",
532512
"10",
533513
)

packages/gapic-generator/gapic/templates/noxfile.py.j2

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,11 +656,21 @@ def import_profile(session):
656656
session.install(".")
657657
{% if api.naming.module_namespace %}
658658
session.run(
659-
"python", str(profiler_script), "--module", "{{ api.naming.module_namespace[0] }}", "--iterations", "10"
659+
"python",
660+
str(profiler_script),
661+
"--module",
662+
"{{ api.naming.module_namespace[0] }}",
663+
"--iterations",
664+
"10",
660665
)
661666
{% else %}
662667
session.run(
663-
"python", str(profiler_script), "--module", "{{ api.naming.versioned_module_name }}", "--iterations", "10"
668+
"python",
669+
str(profiler_script),
670+
"--module",
671+
"{{ api.naming.versioned_module_name }}",
672+
"--iterations",
673+
"10",
664674
)
665675
{% endif %}
666676
{% endblock %}

packages/gapic-generator/noxfile.py

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ def lint(session):
726726
"""
727727

728728
# TODO(https://github.com/googleapis/google-cloud-python/issues/16186):
729-
# SKIP: This session was not enforced in the standalone (split) repo
729+
# SKIP: This session was not enforced in the standalone (split) repo
730730
# and is disabled here to ensure a "move-only" migration.
731731
session.skip(
732732
"Linting was not enforced in the split repo. "
@@ -756,11 +756,9 @@ def lint(session):
756756
@nox.session(python=NEWEST_PYTHON)
757757
def lint_setup_py(session):
758758
# TODO(https://github.com/googleapis/google-cloud-python/issues/16186):
759-
# SKIP: This session was not enforced in the standalone (split) repo
759+
# SKIP: This session was not enforced in the standalone (split) repo
760760
# and is disabled here to ensure a "move-only" migration.
761-
session.skip(
762-
"Skipping now to avoid changing code during migration. See Issue #16186"
763-
)
761+
session.skip("Skipping now to avoid changing code during migration. See Issue #16186")
764762

765763

766764
@nox.session(python="3.10")
@@ -835,11 +833,9 @@ def prerelease_deps(session, protobuf_implementation):
835833
"""
836834
Run all tests with pre-release versions of dependencies installed.
837835
"""
838-
# TODO(https://github.com/googleapis/google-cloud-python/issues/16184):
836+
# TODO(https://github.com/googleapis/google-cloud-python/issues/16184):
839837
# Implement pre-release dependency logic to test against upcoming runtime changes.
840-
session.skip(
841-
"prerelease_deps session is not yet implemented for gapic-generator-python."
842-
)
838+
session.skip("prerelease_deps session is not yet implemented for gapic-generator-python.")
843839

844840

845841
@nox.session(python=NEWEST_PYTHON)
@@ -849,27 +845,9 @@ def prerelease_deps(session, protobuf_implementation):
849845
)
850846
def core_deps_from_source(session, protobuf_implementation):
851847
"""Run all tests with core dependencies installed from source."""
852-
# TODO(https://github.com/googleapis/google-cloud-python/issues/16185):
848+
# TODO(https://github.com/googleapis/google-cloud-python/issues/16185):
853849
# Implement logic to install core packages directly from the mono-repo directories.
854-
session.skip(
855-
"core_deps_from_source session is not yet implemented for gapic-generator-python."
856-
)
857-
858-
859-
@nox.session(python="3.15")
860-
def import_profile(session):
861-
"""Ensure import times remain below defined thresholds."""
862-
profiler_script = (
863-
CURRENT_DIRECTORY.parent.parent / "scripts" / "import_profiler" / "profiler.py"
864-
)
865-
if not profiler_script.exists():
866-
session.skip("The import profiler script was not found.")
867-
868-
session.install(".")
869-
session.run(
870-
"python", str(profiler_script), "--module", "google", "--iterations", "10"
871-
)
872-
850+
session.skip("core_deps_from_source session is not yet implemented for gapic-generator-python.")
873851

874852
@nox.session(python="3.15")
875853
def import_profile(session):
@@ -882,5 +860,10 @@ def import_profile(session):
882860

883861
session.install(".")
884862
session.run(
885-
"python", str(profiler_script), "--module", "google", "--iterations", "10"
863+
"python",
864+
str(profiler_script),
865+
"--module",
866+
"google",
867+
"--iterations",
868+
"10",
886869
)

packages/gapic-generator/tests/integration/goldens/asset/noxfile.py

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,7 @@
4848
# Path to the centralized mypy configuration file at the repository root.
4949
# Search upwards to support running nox from both monorepo packages and integration test goldens.
5050
MYPY_CONFIG_FILE = next(
51-
(
52-
str(p / "mypy.ini")
53-
for p in CURRENT_DIRECTORY.parents
54-
if (p / "mypy.ini").exists()
55-
),
51+
(str(p / "mypy.ini") for p in CURRENT_DIRECTORY.parents if (p / "mypy.ini").exists()),
5652
str(CURRENT_DIRECTORY.parent.parent / "mypy.ini"),
5753
)
5854

@@ -168,8 +164,7 @@ def lint(session):
168164

169165
# 2. Check formatting
170166
session.run(
171-
"ruff",
172-
"format",
167+
"ruff", "format",
173168
"--check",
174169
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
175170
"--line-length=88",
@@ -182,15 +177,12 @@ def lint(session):
182177
@nox.session(python=DEFAULT_PYTHON_VERSION)
183178
def blacken(session):
184179
"""(Deprecated) Legacy session. Please use 'nox -s format'."""
185-
session.log(
186-
"WARNING: The 'blacken' session is deprecated and will be removed in a future release. Please use 'nox -s format' in the future."
187-
)
180+
session.log("WARNING: The 'blacken' session is deprecated and will be removed in a future release. Please use 'nox -s format' in the future.")
188181

189182
# Just run the ruff formatter (keeping legacy behavior of only formatting, not sorting imports)
190183
session.install(RUFF_VERSION)
191184
session.run(
192-
"ruff",
193-
"format",
185+
"ruff", "format",
194186
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
195187
"--line-length=88",
196188
*LINT_PATHS,
@@ -209,10 +201,8 @@ def format(session):
209201
# check --select I: Enables strict import sorting
210202
# --fix: Applies the changes automatically
211203
session.run(
212-
"ruff",
213-
"check",
214-
"--select",
215-
"I",
204+
"ruff", "check",
205+
"--select", "I",
216206
"--fix",
217207
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
218208
"--line-length=88", # Standard Black line length
@@ -221,8 +211,7 @@ def format(session):
221211

222212
# 3. Run Ruff to format code
223213
session.run(
224-
"ruff",
225-
"format",
214+
"ruff", "format",
226215
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
227216
"--line-length=88", # Standard Black line length
228217
*LINT_PATHS,
@@ -407,10 +396,8 @@ def docs(session):
407396
"sphinx-build",
408397
"-T", # show full traceback on exception
409398
"-N", # no colors
410-
"-b",
411-
"html", # builder
412-
"-d",
413-
os.path.join("docs", "_build", "doctrees", ""), # cache directory
399+
"-b", "html", # builder
400+
"-d", os.path.join("docs", "_build", "doctrees", ""), # cache directory
414401
# paths to build:
415402
os.path.join("docs", ""),
416403
os.path.join("docs", "_build", "html", ""),
@@ -524,7 +511,8 @@ def prerelease_deps(session, protobuf_implementation):
524511
# Extract the base package name, safely ignoring version bounds and spaces
525512
# (e.g., "grpcio>=1.75.1" becomes "grpcio")
526513
parsed_deps = {
527-
dep: re.match(r"^([a-zA-Z0-9_-]+)", dep).group(1) for dep in prerel_deps
514+
dep: re.match(r"^([a-zA-Z0-9_-]+)", dep).group(1)
515+
for dep in prerel_deps
528516
}
529517

530518
# Dynamically sort local packages vs PyPI dependencies
@@ -637,9 +625,7 @@ def core_deps_from_source(session, protobuf_implementation):
637625
dep_paths = [str(deps_dir / dep) for dep in core_dependencies_from_source]
638626

639627
session.install(*dep_paths, "--no-deps", "--ignore-installed")
640-
print(
641-
f"Installed {', '.join(core_dependencies_from_source)} locally from {deps_dir}"
642-
)
628+
print(f"Installed {', '.join(core_dependencies_from_source)} locally from {deps_dir}")
643629

644630
session.run(
645631
"py.test",
@@ -661,5 +647,10 @@ def import_profile(session):
661647

662648
session.install(".")
663649
session.run(
664-
"python", str(profiler_script), "--module", "google", "--iterations", "10"
650+
"python",
651+
str(profiler_script),
652+
"--module",
653+
"google",
654+
"--iterations",
655+
"10",
665656
)

0 commit comments

Comments
 (0)