Skip to content

Commit 7381511

Browse files
committed
reverted core_deps changes
1 parent 90ce674 commit 7381511

22 files changed

Lines changed: 130 additions & 301 deletions

File tree

.github/workflows/unittest.yml

Lines changed: 10 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -40,33 +40,15 @@ jobs:
4040
# Each weight is roughly 1 minute of expected execution time
4141
# Default for unset packages is 1
4242
PACKAGE_WEIGHTS: |
43-
django-google-spanner: 2
44-
gapic-generator: 3
45-
google-ai-generativelanguage: 3
46-
google-api-core: 2
47-
google-auth: 2
48-
google-cloud-bigquery: 4
49-
google-cloud-bigquery-storage: 2
50-
google-cloud-bigtable: 4
43+
google-ai-generativelanguage: 4
44+
google-auth: 5
5145
google-cloud-compute: 12
5246
google-cloud-compute-v1beta: 12
53-
google-cloud-datastore: 3
54-
google-cloud-dialogflow: 4
55-
google-cloud-dialogflow-cx: 4
56-
google-cloud-discoveryengine: 4
57-
google-cloud-firestore: 3
58-
google-cloud-logging: 3
59-
google-cloud-monitoring: 3
60-
google-cloud-ndb: 2
61-
google-cloud-pubsub: 2
62-
google-cloud-retail: 3
63-
google-cloud-spanner: 4
64-
google-cloud-storage: 4
65-
google-shopping-merchant-accounts: 3
66-
pandas-gbq: 2
67-
proto-plus: 1
68-
sqlalchemy-bigquery: 2
69-
sqlalchemy-spanner: 2
47+
google-cloud-dialogflow: 6
48+
google-cloud-dialogflow-cx: 6
49+
google-cloud-discoveryengine: 8
50+
google-cloud-retail: 5
51+
google-shopping-merchant-accounts: 4
7052
steps:
7153
- name: Checkout
7254
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
@@ -174,52 +156,12 @@ jobs:
174156
path: .coverage.${{ matrix.python }}.*
175157
include-hidden-files: true
176158

177-
core-deps:
178-
needs: initialize
179-
if: needs.initialize.outputs.matrix != '[]' && needs.initialize.outputs.matrix != ''
180-
runs-on: ubuntu-22.04
181-
strategy:
182-
fail-fast: true
183-
matrix:
184-
python: ["3.14"]
185-
package_shard: ${{ fromJson(needs.initialize.outputs.matrix) }}
186-
name: ${{ matrix.package_shard.is_sharded && format('core-deps handwritten ({0}, {1})', matrix.python, matrix.package_shard.name) || format('core-deps handwritten ({0})', matrix.python) }}
187-
steps:
188-
- name: Checkout
189-
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
190-
# Use a fetch-depth of 2 to avoid error `fatal: origin/main...HEAD: no merge base`
191-
# See https://github.com/googleapis/google-cloud-python/issues/12013
192-
# and https://github.com/actions/checkout#checkout-head.
193-
with:
194-
fetch-depth: 2
195-
persist-credentials: false
196-
- name: Setup Python
197-
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
198-
with:
199-
python-version: ${{ matrix.python }}
200-
cache: 'pip'
201-
allow-prereleases: true
202-
- name: Install nox
203-
run: |
204-
pip install nox
205-
- name: Run core_deps_from_source for ${{ matrix.package_shard.description }}
206-
env:
207-
BUILD_TYPE: presubmit
208-
TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref }}
209-
TEST_TYPE: core_deps_from_source
210-
PY_VERSION: ${{ matrix.python }}
211-
PACKAGE_LIST: ${{ matrix.package_shard.packages }}
212-
NOX_DEFAULT_VENV_BACKEND: "virtualenv"
213-
NOXFORCEPYTHON: ${{ matrix.python }}
214-
run: |
215-
ci/run_conditional_tests.sh
216-
217159
all-tests:
218-
needs: [initialize, unit, core-deps]
160+
needs: [initialize, unit]
219161
if: always()
220162
runs-on: ubuntu-latest
221163
steps:
222-
- name: Check test results
164+
- name: Check unit test results
223165
run: |
224166
# 1. Check initialize job
225167
if [[ "${{ needs.initialize.result }}" != "success" ]]; then
@@ -231,12 +173,7 @@ jobs:
231173
echo "Unit tests failed"
232174
exit 1
233175
fi
234-
# 3. Check core dependencies test shards
235-
if [[ "${{ needs.core-deps.result }}" != "success" && "${{ needs.core-deps.result }}" != "skipped" ]]; then
236-
echo "Core dependencies tests failed"
237-
exit 1
238-
fi
239-
echo "All unit and core dependencies tests passed or were skipped"
176+
echo "All unit tests passed or were skipped"
240177
241178
cover:
242179
if: always() && !cancelled() && needs.all-tests.result == 'success'

ci/get_package_shards.py

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,9 @@ def get_package_weights():
7070
return weights
7171

7272

73-
def get_packages(handwritten_only=False):
73+
def get_packages():
7474
"""Lists all package directory paths in the repository grouped by package name.
7575
76-
If handwritten_only is True, includes only non-GAPIC_AUTO libraries.
77-
7876
Returns:
7977
dict: A dictionary mapping package_name -> list of relative directory paths.
8078
"""
@@ -85,19 +83,8 @@ def get_packages(handwritten_only=False):
8583
continue
8684
for d in os.listdir(subdir):
8785
full_path = os.path.join(subdir, d) + '/'
88-
if not os.path.isdir(full_path):
89-
continue
90-
if handwritten_only:
91-
meta_file = os.path.join(full_path, ".repo-metadata.json")
92-
if os.path.exists(meta_file):
93-
try:
94-
with open(meta_file) as f:
95-
data = json.load(f)
96-
if data.get("library_type") == "GAPIC_AUTO":
97-
continue
98-
except Exception:
99-
pass
100-
packages_map[d].append(full_path)
86+
if os.path.isdir(full_path):
87+
packages_map[d].append(full_path)
10188
return packages_map
10289

10390

@@ -145,22 +132,6 @@ def get_packages_to_test():
145132
if full_path not in to_test_paths[pkg_name]:
146133
to_test_paths[pkg_name].append(full_path)
147134

148-
# Core dependency packages whose changes require testing across downstream handwritten packages
149-
core_packages = {
150-
"google-api-core",
151-
"google-auth",
152-
"google-auth-httplib2",
153-
"google-auth-oauthlib",
154-
"google-cloud-core",
155-
"googleapis-common-protos",
156-
"grpc-google-iam-v1",
157-
"proto-plus",
158-
"google-crc32c",
159-
}
160-
if any(pkg in core_packages for pkg in to_test_paths):
161-
# When a core package changes, test all handwritten packages (non-GAPIC_AUTO)
162-
return get_packages(handwritten_only=True)
163-
164135
return dict(to_test_paths)
165136

166137

ci/run_single_test.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ case ${TEST_TYPE} in
6868
nox -s prerelease_deps-3.14
6969
retval=$?
7070
;;
71-
core_deps_from_source)
72-
if [[ "$(pwd)" == */preview-packages/* ]]; then
73-
echo "Skipping core_deps_from_source for preview package $(pwd)"
74-
exit 0
75-
fi
76-
nox --stop-on-first-error -s core_deps_from_source
77-
retval=$?
78-
;;
7971
unit)
8072
case ${PY_VERSION} in
8173
"3.10")

packages/db-dtypes/noxfile.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -512,27 +512,16 @@ def core_deps_from_source(session, protobuf_implementation):
512512
install_unittest_dependencies(session, "-c", constraints_path)
513513

514514
core_dependencies_from_source = [
515-
"googleapis-common-protos",
516-
"google-api-core",
517-
"google-auth",
518-
"grpc-google-iam-v1",
519-
"proto-plus",
515+
"googleapis-common-protos @ git+https://github.com/googleapis/google-cloud-python#egg=googleapis-common-protos&subdirectory=packages/googleapis-common-protos",
516+
"google-api-core @ git+https://github.com/googleapis/google-cloud-python#egg=google-api-core&subdirectory=packages/google-api-core",
517+
"google-auth @ git+https://github.com/googleapis/google-cloud-python#egg=google-auth&subdirectory=packages/google-auth",
518+
"grpc-google-iam-v1 @ git+https://github.com/googleapis/google-cloud-python#egg=grpc-google-iam-v1&subdirectory=packages/grpc-google-iam-v1",
519+
"proto-plus @ git+https://github.com/googleapis/google-cloud-python#egg=proto-plus&subdirectory=packages/proto-plus",
520520
]
521521

522-
deps_dir = CURRENT_DIRECTORY.parent
523-
while deps_dir.name != "packages" and deps_dir.parent != deps_dir:
524-
deps_dir = deps_dir.parent
525-
526-
local_paths = [
527-
str(deps_dir / dep)
528-
for dep in core_dependencies_from_source
529-
if (deps_dir / dep).exists()
530-
]
531-
if local_paths:
532-
session.install(*local_paths, "--no-deps", "--ignore-installed")
533-
print(
534-
f"Installed {', '.join(core_dependencies_from_source)} locally from {deps_dir}"
535-
)
522+
for dep in core_dependencies_from_source:
523+
session.install(dep, "--no-deps", "--ignore-installed")
524+
print(f"Installed {dep}")
536525

537526
tests_path = os.path.join("tests", "unit")
538527
session.run(

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import os
66
import pathlib
77
import re
88
import shutil
9-
import warnings
9+
1010
from typing import Dict, List
11+
import warnings
1112

1213
import nox
1314

@@ -162,7 +163,7 @@ def lint(session):
162163
"ruff", "format",
163164
"--check",
164165
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
165-
"--line-length=88",
166+
"--line-length=88",
166167
*LINT_PATHS,
167168
)
168169
@@ -178,7 +179,7 @@ def lint(session):
178179
def blacken(session):
179180
"""(Deprecated) Legacy session. Please use 'nox -s format'."""
180181
session.log("WARNING: The 'blacken' session is deprecated and will be removed in a future release. Please use 'nox -s format' in the future.")
181-
182+
182183
# Just run the ruff formatter (keeping legacy behavior of only formatting, not sorting imports)
183184
session.install(RUFF_VERSION)
184185
session.run(
@@ -517,14 +518,14 @@ def prerelease_deps(session, protobuf_implementation):
517518
# Extract the base package name, safely ignoring version bounds and spaces
518519
# (e.g., "grpcio>=1.75.1" becomes "grpcio")
519520
parsed_deps = {
520-
dep: re.match(r"^([a-zA-Z0-9_-]+)", dep).group(1)
521+
dep: re.match(r"^([a-zA-Z0-9_-]+)", dep).group(1)
521522
for dep in prerel_deps
522523
}
523524

524525
# Dynamically sort local packages vs PyPI dependencies
525526
local_paths = []
526527
pypi_deps = []
527-
528+
528529
for dep, pkg_name in parsed_deps.items():
529530
if (deps_dir / pkg_name).exists():
530531
local_paths.append(str(deps_dir / pkg_name))
@@ -623,16 +624,13 @@ def core_deps_from_source(session, protobuf_implementation):
623624
"proto-plus",
624625
]
625626

626-
# Locate the monorepo 'packages' directory containing core dependencies
627-
deps_dir = next(
628-
p / "packages"
629-
for p in CURRENT_DIRECTORY.parents
630-
if (p / "packages").is_dir()
631-
)
627+
deps_dir = CURRENT_DIRECTORY.parent
628+
while deps_dir.name != "packages" and deps_dir.parent != deps_dir:
629+
deps_dir = deps_dir.parent
632630

633631
# Batch the pip installation to avoid sequential overhead
634632
dep_paths = [str(deps_dir / dep) for dep in core_dependencies_from_source]
635-
633+
636634
session.install(*dep_paths, "--no-deps", "--ignore-installed")
637635
print(f"Installed {', '.join(core_dependencies_from_source)} locally from {deps_dir}")
638636

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
import pathlib
1818
import re
1919
import shutil
20-
import warnings
20+
2121
from typing import Dict, List
22+
import warnings
2223

2324
import nox
2425

@@ -615,12 +616,9 @@ def core_deps_from_source(session, protobuf_implementation):
615616
"proto-plus",
616617
]
617618

618-
# Locate the monorepo 'packages' directory containing core dependencies
619-
deps_dir = next(
620-
p / "packages"
621-
for p in CURRENT_DIRECTORY.parents
622-
if (p / "packages").is_dir()
623-
)
619+
deps_dir = CURRENT_DIRECTORY.parent
620+
while deps_dir.name != "packages" and deps_dir.parent != deps_dir:
621+
deps_dir = deps_dir.parent
624622

625623
# Batch the pip installation to avoid sequential overhead
626624
dep_paths = [str(deps_dir / dep) for dep in core_dependencies_from_source]

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
import pathlib
1818
import re
1919
import shutil
20-
import warnings
20+
2121
from typing import Dict, List
22+
import warnings
2223

2324
import nox
2425

@@ -615,12 +616,9 @@ def core_deps_from_source(session, protobuf_implementation):
615616
"proto-plus",
616617
]
617618

618-
# Locate the monorepo 'packages' directory containing core dependencies
619-
deps_dir = next(
620-
p / "packages"
621-
for p in CURRENT_DIRECTORY.parents
622-
if (p / "packages").is_dir()
623-
)
619+
deps_dir = CURRENT_DIRECTORY.parent
620+
while deps_dir.name != "packages" and deps_dir.parent != deps_dir:
621+
deps_dir = deps_dir.parent
624622

625623
# Batch the pip installation to avoid sequential overhead
626624
dep_paths = [str(deps_dir / dep) for dep in core_dependencies_from_source]

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
import pathlib
1818
import re
1919
import shutil
20-
import warnings
20+
2121
from typing import Dict, List
22+
import warnings
2223

2324
import nox
2425

@@ -615,12 +616,9 @@ def core_deps_from_source(session, protobuf_implementation):
615616
"proto-plus",
616617
]
617618

618-
# Locate the monorepo 'packages' directory containing core dependencies
619-
deps_dir = next(
620-
p / "packages"
621-
for p in CURRENT_DIRECTORY.parents
622-
if (p / "packages").is_dir()
623-
)
619+
deps_dir = CURRENT_DIRECTORY.parent
620+
while deps_dir.name != "packages" and deps_dir.parent != deps_dir:
621+
deps_dir = deps_dir.parent
624622

625623
# Batch the pip installation to avoid sequential overhead
626624
dep_paths = [str(deps_dir / dep) for dep in core_dependencies_from_source]

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
import pathlib
1818
import re
1919
import shutil
20-
import warnings
20+
2121
from typing import Dict, List
22+
import warnings
2223

2324
import nox
2425

@@ -615,12 +616,9 @@ def core_deps_from_source(session, protobuf_implementation):
615616
"proto-plus",
616617
]
617618

618-
# Locate the monorepo 'packages' directory containing core dependencies
619-
deps_dir = next(
620-
p / "packages"
621-
for p in CURRENT_DIRECTORY.parents
622-
if (p / "packages").is_dir()
623-
)
619+
deps_dir = CURRENT_DIRECTORY.parent
620+
while deps_dir.name != "packages" and deps_dir.parent != deps_dir:
621+
deps_dir = deps_dir.parent
624622

625623
# Batch the pip installation to avoid sequential overhead
626624
dep_paths = [str(deps_dir / dep) for dep in core_dependencies_from_source]

0 commit comments

Comments
 (0)