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
13 changes: 13 additions & 0 deletions e2e/cases/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,19 @@ write_source_files(
# decide_marker emitted — is already pinned by project_single above.)
"snapshots/extra_marker.private.sccs.BUILD.bazel": "@project__extra_marker//private/sccs:BUILD.bazel",

# @pypi_dedup (dedup-installs: three lock universes over a shared set of
# pure-bdist packages, with varying deps and exclude_glob overrides).
# Removal proof: this genquery lists every wheel-install repo reachable
# from all three projects' targets. Without dedup it names 26 repos
# (canonical 9 + duplicate 9 + triplicate 8); the pinned file has 12 —
# the identities that survive after matching (wheels, exclude_glob)
# installs collapse. The repo names encode which projects shared: e.g.
# both a `_canonical_ pyflakes` (excluded) and a `_duplicate_ pyflakes`
# (unexcluded, shared with triplicate) survive, while pycodestyle and
# toml each collapse their two same-exclusion copies into one and leave
# the odd-one-out separate. See dedup-installs/setup.MODULE.bazel.
"snapshots/dedup_installs.shared_install_repos.query": "//dedup-installs:shared_install_repos",

# @whl_install for grpcio with bare linux_* wheels
# ----------------------------------------------------------------
# grpcio 1.80.0 ships bare linux_armv7l wheels alongside manylinux/
Expand Down
1 change: 1 addition & 0 deletions e2e/cases/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ include("//azure-namespace-sibling:setup.MODULE.bazel")
include("//coverage-drivers:setup.MODULE.bazel")
include("//cross-repo-610:setup.MODULE.bazel")
include("//current-py-toolchain-bazel-env-896:setup.MODULE.bazel")
include("//dedup-installs:setup.MODULE.bazel")
include("//firebase-admin-import:setup.MODULE.bazel")
include("//freethreaded-805:setup.MODULE.bazel")
include("//google-native-overlay:setup.MODULE.bazel")
Expand Down
66 changes: 66 additions & 0 deletions e2e/cases/dedup-installs/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Three lock universes (`canonical`, `duplicate`, `triplicate`) over a shared
# set of pure-bdist packages, with slightly varying deps and exclude_glob
# overrides (see setup.MODULE.bazel). Each test builds+runs against the shared
# deduplicated install repos, proving the reference rewrite leaves no dangling
# label. The //snapshots dedup-installs entry pins the dedup signature.
load("@aspect_rules_py//py:defs.bzl", "py_test")

# The seven packages every project shares. canonical/duplicate add mccabe.
_COMMON_PACKAGES = [
"@pypi_dedup//cachetools",
"@pypi_dedup//decorator",
"@pypi_dedup//distlib",
"@pypi_dedup//inflection",
"@pypi_dedup//pycodestyle",
"@pypi_dedup//pyflakes",
"@pypi_dedup//sortedcontainers",
"@pypi_dedup//toml",
]

# The dedup proof: enumerate every wheel-install repo reachable from all three
# lock universes. The query is unconfigured, so it walks every select() arm of
# all three projects. Without the dedup this lists 26 repos (canonical 9 +
# duplicate 9 + triplicate 8); the pinned snapshot has 12 — the surviving
# identities after collapsing matching (wheels, exclude_glob) installs.
genquery(
name = "shared_install_repos",
expression = "filter(\"whl_install__shared_install_.*//:install$\", deps(//dedup-installs:canonical) + deps(//dedup-installs:duplicate) + deps(//dedup-installs:triplicate))",
scope = [
"//dedup-installs:canonical",
"//dedup-installs:duplicate",
"//dedup-installs:triplicate",
],
visibility = ["//:__pkg__"],
)

# Each test resolves its packages through its own project's dep_group config,
# so the three lock universes are exercised independently while landing on the
# shared install repos. The smoke test imports only the common packages so it
# runs unchanged against triplicate (which omits mccabe); pyflakes and
# pycodestyle are imported to prove the exclude_glob installs still work.
py_test(
name = "canonical",
srcs = ["__test__.py"],
dep_group = "shared-install-canonical",
main = "__test__.py",
python_version = "3.11",
deps = _COMMON_PACKAGES + ["@pypi_dedup//mccabe"],
)

py_test(
name = "duplicate",
srcs = ["__test__.py"],
dep_group = "shared-install-duplicate",
main = "__test__.py",
python_version = "3.11",
deps = _COMMON_PACKAGES + ["@pypi_dedup//mccabe"],
)

py_test(
name = "triplicate",
srcs = ["__test__.py"],
dep_group = "shared-install-triplicate",
main = "__test__.py",
python_version = "3.11",
deps = _COMMON_PACKAGES,
)
16 changes: 16 additions & 0 deletions e2e/cases/dedup-installs/__test__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python3
"""Smoke test that every lock universe resolves the shared package set,
including the packages that carry an exclude_glob override."""

import cachetools
import decorator
import distlib
import inflection
import pycodestyle
import pyflakes
import sortedcontainers
import toml

assert toml.loads("k = 1")["k"] == 1
assert inflection.camelize("dedup_installs") == "DedupInstalls"
assert sortedcontainers.SortedList([3, 1, 2]) == [1, 2, 3]
4 changes: 4 additions & 0 deletions e2e/cases/dedup-installs/canonical/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
exports_files([
"pyproject.toml",
"uv.lock",
])
16 changes: 16 additions & 0 deletions e2e/cases/dedup-installs/canonical/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[project]
name = "shared-install-canonical"
version = "0.0.0"
authors = []
requires-python = ">=3.11"
dependencies = [
"cachetools",
"decorator",
"distlib",
"inflection",
"mccabe",
"pycodestyle",
"pyflakes",
"sortedcontainers",
"toml",
]
94 changes: 94 additions & 0 deletions e2e/cases/dedup-installs/canonical/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions e2e/cases/dedup-installs/duplicate/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
exports_files([
"pyproject.toml",
"uv.lock",
])
16 changes: 16 additions & 0 deletions e2e/cases/dedup-installs/duplicate/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[project]
name = "shared-install-duplicate"
version = "0.0.0"
authors = []
requires-python = ">=3.11"
dependencies = [
"cachetools",
"decorator",
"distlib",
"inflection",
"mccabe",
"pycodestyle",
"pyflakes",
"sortedcontainers",
"toml",
]
94 changes: 94 additions & 0 deletions e2e/cases/dedup-installs/duplicate/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading