bazel-contrib / bazel-contrib/rules_uv

`--universal` breaks `_test` when extra markers are added

Open
#243 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
29
Forks
12
PR merge metrics
No merged PRs in 30d

Description

### Summary
Adding `extra_args = ["--universal"]` to `pip_compile()` causes the generated `_test` to fail if there is configuration in `uv.toml` that causes extra markers to be added to the lock file.

### Minimal steps to reproduce:
`requirements.in` has just:
```
argparse >= 1.4.0
```

`uv.toml` has:
```
environments = ["sys_platform != 'darwin'"]
```

`BUILD.bazel` has:
```
load("@rules_uv//uv:pip.bzl", "pip_compile")

pip_compile(
name = "requirements",
extra_args = ["--universal"],
requirements_in = "requirements.in",
requirements_txt = "requirements.lock",
)
```
Then run:
```
bazel run //:requirements
bazel test //:requirements_test
```
which fails with:
```
FAIL: //:requirements_test (Exit 1) (see /home/baxelrod/.cache/bazel/_bazel_baxelrod/223f490fa0c2f2ec38707ddac3dd6272/execroot/_main/bazel-out/k8-fastbuild/testlogs/requirements_test/test.log)
INFO: From Testing //:requirements_test:
==================== Test output for //:requirements_test:
FAIL: requirements.lock is out-of-date. Run 'bazel run @@//:requirements' to update.
5c5
< argparse==1.4.0 ; sys_platform != 'darwin' \
---
> argparse==1.4.0 \
================================================================================
Target //:requirements_test up-to-date:
bazel-bin/requirements_test
INFO: Elapsed time: 0.633s, Critical Path: 0.37s
INFO: 2 processes: 5 action cache hit, 2 linux-sandbox.
INFO: Build completed, 1 test FAILED, 2 total actions
//:requirements_test FAILED in 0.3s
```

But if you remove the `--universal` argument, or line in `uv.toml` then it succeeds.

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure using requirements.in, uv.toml, and BUILD.bazel with pip_compile(extra_args = ["--universal"]), then run bazel run //:requirements and bazel test //:requirements_test. Compare the generated requirements.lock with the expected marker-bearing output; done means the generated lock file is accepted by requirements_test without removing --universal or the uv.toml configuration.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.