Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1db8653
fix(uv): allow overriding with shell environment
aignas May 28, 2026
3d514ce
test(uv_lock): add integration test for shell env override in lock.up…
aignas May 28, 2026
9300666
use pypiserver for the integration test setup instead of a custom PyP…
aignas May 29, 2026
61f06ad
doc: changelog
aignas May 29, 2026
fc5a48b
add a hash
aignas May 29, 2026
3ac8ee4
add another test
aignas May 29, 2026
6c6a887
docs: document credential helper support for uv lock rule
aignas May 29, 2026
d314931
add docs and adjust changelog
aignas May 29, 2026
0e20490
also run the credential tests
aignas May 29, 2026
de5fe1c
vibe: rev 2
aignas May 29, 2026
1545f6b
Apply suggestions from code review
rickeylev May 31, 2026
116a60a
vibe: course adjust
aignas May 30, 2026
ea78868
wip
aignas Jun 1, 2026
cc734d6
fix(pypi): do not fail on indexes without root index (#3799)
aignas May 29, 2026
2dcb2a7
fix(build-data): remove CONFIG_MODE from build data (#3801)
rickeylev May 31, 2026
6c6cc84
chore: tell agents to not amend or rebase PRs (#3804)
rickeylev Jun 1, 2026
e0bec20
test(mocks): extract mock python extension helper (#3803)
rickeylev Jun 1, 2026
0b588c0
revert unrelated changes
aignas Jun 1, 2026
56ef0d9
remove unnecessary code
aignas Jun 1, 2026
3362ba1
add a note
aignas Jun 1, 2026
bbb4900
wip
aignas Jun 1, 2026
cd9eeb8
wip
aignas Jun 1, 2026
2b7f8ee
wip
aignas Jun 1, 2026
565e2db
wip
aignas Jun 1, 2026
2f7da6c
Merge branch 'main' into aignas.fix.uv-allow-env-setting
aignas Jun 1, 2026
e4f328c
wip
aignas Jun 1, 2026
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
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ tests/integration/compile_pip_requirements/bazel-compile_pip_requirements
tests/integration/local_toolchains/bazel-local_toolchains
tests/integration/py_cc_toolchain_registered/bazel-py_cc_toolchain_registered
tests/integration/toolchain_target_settings/bazel-module_under_test
tests/integration/uv_lock/bazel-uv_lock
1 change: 1 addition & 0 deletions .bazelrc.deleted_packages
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ common --deleted_packages=tests/integration/pip_parse/empty
common --deleted_packages=tests/integration/pip_parse_isolated
common --deleted_packages=tests/integration/py_cc_toolchain_registered
common --deleted_packages=tests/integration/toolchain_target_settings
common --deleted_packages=tests/integration/uv_lock
common --deleted_packages=tests/modules/another_module
common --deleted_packages=tests/modules/other
common --deleted_packages=tests/modules/other/nspkg_delta
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ END_UNRELEASED_TEMPLATE
* (pypi) `package_metadata` support, fixes
[#2054](https://github.com/bazel-contrib/rules_python/issues/2054).
* (coverage) Add support for python 3.14 and bump `coverage.py` to 7.10.7.
* (uv) allow user overwrite the build environment using `--action_env` to allow
setting authentication for the index URL.
([#3045](https://github.com/bazel-contrib/rules_python/issues/3405))

{#v2-0-2}
## [2.0.2] - 2026-05-14
Expand Down
5 changes: 5 additions & 0 deletions python/uv/private/lock.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ def _lock_impl(ctx):
uv,
python_files,
],
# User reported being unable to add `--action_env` and get it to work.
# Without this flag.
#
# Ref: https://app.slack.com/client/TA4K1KQ87/CA306CEV6
use_default_shell_env = True,
progress_message = "Creating a requirements.txt with uv: %{label}",
env = ctx.attr.env,
)
Expand Down
7 changes: 7 additions & 0 deletions tests/integration/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ test_suite(
tests = [
"bzlmod_lockfile_test_bazel_9.1.0",
"local_toolchains_test_bazel_self",
"uv_lock_test_bazel_self",
],
)

Expand Down Expand Up @@ -111,6 +112,12 @@ rules_python_integration_test(
py_main = "toolchain_target_settings_test.py",
)

rules_python_integration_test(
name = "uv_lock_test",
py_deps = ["@pypiserver//pypiserver"],
py_main = "uv_lock_test.py",
)

py_library(
name = "runner_lib",
srcs = ["runner.py"],
Expand Down
7 changes: 5 additions & 2 deletions tests/integration/integration_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ load(
)
load("//python:py_test.bzl", "py_test")

def _test_runner(*, name, bazel_version, py_main, bzlmod):
def _test_runner(*, name, bazel_version, py_main, bzlmod, py_deps):
if py_main:
test_runner = "{}_bazel_{}_py_runner".format(name, bazel_version)
py_test(
name = test_runner,
srcs = [py_main],
main = py_main,
deps = [":runner_lib"],
deps = [":runner_lib"] + py_deps,
# Hide from ... patterns; should only be run as part
# of the bazel integration test
tags = ["manual"],
Expand All @@ -46,6 +46,7 @@ def rules_python_integration_test(
bzlmod = True,
tags = None,
py_main = None,
py_deps = None,
bazel_versions = None,
**kwargs):
"""Runs a bazel-in-bazel integration test.
Expand All @@ -60,6 +61,7 @@ def rules_python_integration_test(
py_main: Optional `.py` file to run tests using. When specified, a
python based test runner is used, and this source file is the main
entry point and responsible for executing tests.
py_deps: Optional test runner deps to use for setup.
bazel_versions: `list[str] | None`, the bazel versions to test. I
not specified, defaults to all configured bazel versions.
**kwargs: Passed to the upstream `bazel_integration_tests` rule.
Expand Down Expand Up @@ -91,6 +93,7 @@ def rules_python_integration_test(
name = name,
bazel_version = bazel_version,
py_main = py_main,
py_deps = py_deps or [],
bzlmod = bzlmod,
)
bazel_integration_test(
Expand Down
5 changes: 5 additions & 0 deletions tests/integration/uv_lock/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build --enable_runfiles
common --experimental_isolated_extension_usages
common --action_env=UV_EXTRA_INDEX_URL

try-import %workspace%/user.bazelrc
1 change: 1 addition & 0 deletions tests/integration/uv_lock/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9.1.0
22 changes: 22 additions & 0 deletions tests/integration/uv_lock/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
load("@rules_python//python/uv:lock.bzl", "lock")
load(":uv_runner.bzl", "uv_runner")

lock(
name = "requirements",
srcs = ["requirements.in"],
out = "requirements.txt",
tags = ["no-remote-exec"],
)

uv_runner(
name = "uv",
tags = ["manual"],
)

diff_test(
name = "requirements_diff_test",
timeout = "short",
file1 = ":requirements",
file2 = ":requirements.txt",
)
17 changes: 17 additions & 0 deletions tests/integration/uv_lock/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module(name = "uv_lock")

bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_python")
local_path_override(
module_name = "rules_python",
path = "../../..",
)

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(python_version = "3.13")

uv = use_extension("@rules_python//python/uv:uv.bzl", "uv")
uv.configure(version = "0.11.2")
use_repo(uv, "uv")

register_toolchains("@uv//:all")
Empty file.
1 change: 1 addition & 0 deletions tests/integration/uv_lock/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
my-local-pkg==1.0.0
5 changes: 5 additions & 0 deletions tests/integration/uv_lock/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file was autogenerated by uv via the following command:
# bazel run //:requirements.update
my-local-pkg==1.0.0 \
--hash=sha256:be24d5183a182e8da4465ae1b7e60324864d1a72866ec9aefa6aaf80a4529eb1
# via -r requirements.in
23 changes: 23 additions & 0 deletions tests/integration/uv_lock/uv_runner.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""A rule exposing the uv binary from the registered toolchain as an executable target.

This allows running ``bazel run //:uv -- <args>`` from the test workspace.
"""

def _uv_runner_impl(ctx):
toolchain_info = ctx.toolchains["@rules_python//python/uv:uv_toolchain_type"]
original_uv_executable = toolchain_info.uv_toolchain_info.uv[DefaultInfo].files_to_run.executable

uv_symlink = ctx.actions.declare_file("uv")
ctx.actions.symlink(output = uv_symlink, target_file = original_uv_executable)

return DefaultInfo(
files = depset([uv_symlink]),
executable = uv_symlink,
runfiles = toolchain_info.default_info.default_runfiles,
)

uv_runner = rule(
implementation = _uv_runner_impl,
executable = True,
toolchains = ["@rules_python//python/uv:uv_toolchain_type"],
)
Loading