Skip to content

Commit c824330

Browse files
committed
fix: normalize default dependency group name to underscores to prevent configuration mismatches
1 parent 934a106 commit c824330

27 files changed

Lines changed: 145 additions & 109 deletions

File tree

e2e/BUILD.bazel

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,7 @@ write_source_files(
3636
name = "snapshots",
3737
testonly = True,
3838
files = {
39-
# @pypi_rdflib_linux — regression: hyphen/underscore normalization in dep_group names.
40-
# ----------------------------------------------------------------
41-
# The project is named "rdflib-linux" (hyphens, Python convention). uv_hub
42-
# currently emits config_setting(name = "rdflib-linux") using the raw name,
43-
# so dep_group = "rdflib_linux" (underscore, Bazel convention) never matches
44-
# → @@platforms//:incompatible. The fix must normalize the name to underscores.
45-
# This snapshot pins the DESIRED (fixed) state; it FAILS today and PASSES once
46-
# uv_hub normalises dep_group names via normalize_name().
39+
# @pypi_rdflib_linux — dep_group names must be underscore-normalized.
4740
"snapshots/pypi_rdflib_linux.dep_group.BUILD.bazel": "@pypi_rdflib_linux//dep_group:BUILD.bazel",
4841

4942
# @pypi_multi (multi-project: alpha, beta, gamma)

e2e/MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ include("//cases/single-project-hub:setup.MODULE.bazel")
108108
include("//cases/unconstrained-dependencies:setup.MODULE.bazel")
109109
include("//cases/uv-abi3-compat-853:setup.MODULE.bazel")
110110
include("//cases/uv-bare-linux-wheels:setup.MODULE.bazel")
111+
include("//cases/uv-hub-cross-project:setup.MODULE.bazel")
111112
include("//cases/uv-conflict-817:setup.MODULE.bazel")
112113
include("//cases/uv-conflict-gte:setup.MODULE.bazel")
113114
include("//cases/uv-conflict-max-863:setup.MODULE.bazel")

e2e/cases/firebase-admin-import/BUILD.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ load("//tools:pth_snapshot.bzl", "extract_venv_pth")
3939
py_test(
4040
name = "test",
4141
srcs = ["test.py"],
42-
dep_group = "firebase-admin-import",
42+
dep_group = "firebase_admin_import",
4343
main = "test.py",
4444
deps = [
4545
"@pypi_firebase_admin_import//firebase_admin",
@@ -53,7 +53,7 @@ py_test(
5353
py_test(
5454
name = "test_tool",
5555
srcs = ["test.py"],
56-
dep_group = "firebase-admin-import",
56+
dep_group = "firebase_admin_import",
5757
expose_venv = True,
5858
isolated = False,
5959
main = "test.py",
@@ -73,7 +73,7 @@ py_test(
7373
py_binary(
7474
name = "firebase_importer",
7575
srcs = ["test.py"],
76-
dep_group = "firebase-admin-import",
76+
dep_group = "firebase_admin_import",
7777
main = "test.py",
7878
deps = [
7979
"@pypi_firebase_admin_import//firebase_admin",

e2e/cases/freethreaded-805/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ _LINUX_X86_64 = [
2626
py_test(
2727
name = "test_bin",
2828
srcs = ["test.py"],
29-
dep_group = "freethreaded-test",
29+
dep_group = "freethreaded_test",
3030
main = "test.py",
3131
python_version = "3.13",
3232
tags = ["manual"],
@@ -46,7 +46,7 @@ platform_transition_test(
4646
py_test(
4747
name = "venv_test_bin",
4848
srcs = ["test.py"],
49-
dep_group = "freethreaded-test",
49+
dep_group = "freethreaded_test",
5050
expose_venv = True,
5151
isolated = False,
5252
main = "test.py",

e2e/cases/pth-namespace-547/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ load("//tools:pth_snapshot.bzl", "extract_venv_pth")
55
py_test(
66
name = "test",
77
srcs = ["__test__.py"],
8-
dep_group = "pth-namespace-547",
8+
dep_group = "pth_namespace_547",
99
expose_venv = True,
1010
isolated = False,
1111
main = "__test__.py",
@@ -21,7 +21,7 @@ py_test(
2121
py_test(
2222
name = "test_legacy",
2323
srcs = ["__test__.py"],
24-
dep_group = "pth-namespace-547",
24+
dep_group = "pth_namespace_547",
2525
main = "__test__.py",
2626
deps = [
2727
"@pypi_pth_namespace_547//jaraco_classes",

e2e/cases/pytest-main-867/BUILD.bazel

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ load("@aspect_rules_py//py:defs.bzl", "py_pytest_main", "py_test")
55
py_test(
66
name = "test_example",
77
srcs = ["test_example.py"],
8-
dep_group = "pytest-main-867",
8+
dep_group = "pytest_main_867",
99
pytest_main = True,
1010
deps = ["@pypi_pytest_main_867//pytest"],
1111
)
@@ -15,7 +15,7 @@ py_test(
1515
py_test(
1616
name = "test_naming_regression",
1717
srcs = ["test_example.py"],
18-
dep_group = "pytest-main-867",
18+
dep_group = "pytest_main_867",
1919
pytest_main = True,
2020
deps = ["@pypi_pytest_main_867//pytest"],
2121
)
@@ -29,7 +29,7 @@ py_test(
2929
"test_a.py",
3030
"test_b.py",
3131
],
32-
dep_group = "pytest-main-867",
32+
dep_group = "pytest_main_867",
3333
pytest_main = True,
3434
deps = ["@pypi_pytest_main_867//pytest"],
3535
)
@@ -39,7 +39,7 @@ py_test(
3939
py_test(
4040
name = "test_collection_check",
4141
srcs = ["test_collection_check.py"],
42-
dep_group = "pytest-main-867",
42+
dep_group = "pytest_main_867",
4343
pytest_main = True,
4444
deps = ["@pypi_pytest_main_867//pytest"],
4545
)
@@ -58,7 +58,7 @@ py_test(
5858
"test_a.py",
5959
":test_direct_main",
6060
],
61-
dep_group = "pytest-main-867",
61+
dep_group = "pytest_main_867",
6262
main = ":__test__test_direct_main__.py",
6363
deps = [
6464
":test_direct_main",

e2e/cases/pytest-mock-530/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ load("@aspect_rules_py//py:defs.bzl", "py_test")
44
py_test(
55
name = "test_mock_py_test",
66
srcs = ["test_mock.py"],
7-
dep_group = "pytest-mock-530",
7+
dep_group = "pytest_mock_530",
88
pytest_main = True,
99
deps = [
1010
"@pypi_pytest_mock_530//pytest",
@@ -18,7 +18,7 @@ py_test(
1818
"__test__.py",
1919
"test_mock.py",
2020
],
21-
dep_group = "pytest-mock-530",
21+
dep_group = "pytest_mock_530",
2222
expose_venv = True,
2323
isolated = False,
2424
main = "__test__.py",

e2e/cases/pytest-subdir-imports/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ py_library(
99
py_test(
1010
name = "test_subdir_import",
1111
srcs = ["tests/test_subdir.py"],
12-
dep_group = "pytest-subdir-imports",
12+
dep_group = "pytest_subdir_imports",
1313
pytest_main = True,
1414
deps = [
1515
":lib",

e2e/cases/pytest-xdist-integration/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ py_test(
1313
"-n",
1414
"2",
1515
],
16-
dep_group = "pytest-xdist-integration",
16+
dep_group = "pytest_xdist_integration",
1717
pytest_main = True,
1818
deps = [
1919
"@pypi_pytest_xdist_integration//pytest",

e2e/cases/rdflib-linux/BUILD.bazel

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
1-
# Regression: pyproject.toml name = "rdflib-linux" (hyphens, standard Python convention)
2-
# causes uv_hub to emit config_setting(name = "rdflib-linux", ...) with the raw name.
3-
# A user writing dep_group = "rdflib_linux" (underscores, natural Bazel convention)
4-
# gets a mismatch: flag "rdflib_linux" ≠ config_setting "rdflib-linux", so
5-
# compatible_with() falls through to //conditions:default and emits
6-
# @@platforms//:incompatible for the entire rdflib alias.
7-
#
8-
# Fix: normalize dep_group names in uv_hub (replace "-" → "_") before emitting
9-
# config_setting targets and flag_values.
101
load("@aspect_rules_py//py:defs.bzl", "py_test")
112
load("@rules_shell//shell:sh_test.bzl", "sh_test")
123

13-
# This sh_test reads the hub's generated dep_group/BUILD.bazel via exports_files()
14-
# — a source-file target that carries NO target_compatible_with, so incompatibility
15-
# does NOT propagate here. The test runs in //... and FAILS while the bug exists.
16-
#
17-
# Root cause it checks: uv_hub emits config_setting(name = "rdflib-linux") using the
18-
# raw pyproject.toml [project].name. A user writing dep_group = "rdflib_linux"
19-
# (underscore, Bazel convention) gets no match → @@platforms//:incompatible.
20-
# Fix: normalize dep_group names with normalize_name() in uv_hub/repository.bzl.
4+
# Regression: hyphenated [project].name caused config_setting names with hyphens,
5+
# breaking dep_group = "rdflib_linux" (underscore) matching. Fix: normalize_name().
216
sh_test(
227
name = "dep_group_names_normalized",
238
srcs = ["check_dep_group_names.sh"],
@@ -26,33 +11,12 @@ sh_test(
2611
target_compatible_with = ["@platforms//os:linux"],
2712
)
2813

29-
# Vector 1: hyphen/underscore mismatch.
30-
# pyproject.toml name = "rdflib-linux" → hub config_setting = "rdflib-linux".
31-
# dep_group = "rdflib_linux" (underscore) doesn't match → @@platforms//:incompatible.
3214
py_test(
3315
name = "rdflib_linux",
3416
srcs = ["__test__.py"],
3517
dep_group = "rdflib_linux",
3618
main = "__test__.py",
3719
python_version = "3.11",
3820
target_compatible_with = ["@platforms//os:linux"],
39-
deps = [
40-
"@pypi_rdflib_linux//rdflib",
41-
],
42-
)
43-
44-
# Vector 2: multi-project hub, rdflib only in one project.
45-
# "other" project shares @pypi_rdflib_linux but has no rdflib dependency.
46-
# Building with dep_group = "other" → rdflib alias has no matching arm
47-
# for "other" → //conditions:default → @@platforms//:incompatible.
48-
py_test(
49-
name = "rdflib_wrong_dep_group",
50-
srcs = ["__test__.py"],
51-
dep_group = "other",
52-
main = "__test__.py",
53-
python_version = "3.11",
54-
target_compatible_with = ["@platforms//os:linux"],
55-
deps = [
56-
"@pypi_rdflib_linux//rdflib",
57-
],
21+
deps = ["@pypi_rdflib_linux//rdflib"],
5822
)

0 commit comments

Comments
 (0)