Skip to content

--universal breaks _test when extra markers are added #243

@baxelrod-bdai

Description

@baxelrod-bdai

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions