Skip to content

Commit 1b5fbf4

Browse files
committed
feat(uv): Create a UV driver
1 parent a25b2cb commit 1b5fbf4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+9460
-3874
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
"e2e/repository-rule-deps",
3434
"e2e/smoke",
3535
"e2e/system-interpreter",
36+
"e2e/uv-deps",
3637
"examples/uv_pip_compile"
3738
]
3839
# TODO: Build Windows tools and add to toolchain

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MODULE.bazel

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ bazel_dep(name = "aspect_bazel_lib", version = "2.16.0") # TODO(alexeagle): rem
1515
bazel_dep(name = "aspect_tools_telemetry", version = "0.2.8")
1616
bazel_dep(name = "bazel_lib", version = "3.0.0-rc.0")
1717
bazel_dep(name = "bazel_skylib", version = "1.4.2")
18-
bazel_dep(name = "rules_python", version = "0.29.0")
19-
bazel_dep(name = "platforms", version = "0.0.7")
18+
bazel_dep(name = "rules_python", version = "1.6.3")
19+
bazel_dep(name = "rules_python_gazelle_plugin", version = "1.6.3")
20+
bazel_dep(name = "platforms", version = "1.0.0")
2021

2122
bazel_lib = use_extension("@aspect_bazel_lib//lib:extensions.bzl", "toolchains")
2223
bazel_lib.expand_template()
@@ -28,7 +29,7 @@ use_repo(tel, "aspect_tools_telemetry_report")
2829
python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True)
2930
python.toolchain(
3031
is_default = False,
31-
python_version = "3.9",
32+
python_version = "3.13",
3233
)
3334

3435
tools = use_extension("//py:extensions.bzl", "py_tools")
@@ -115,3 +116,29 @@ oci.pull(
115116
tag = "latest",
116117
)
117118
use_repo(oci, "ubuntu", "ubuntu_linux_amd64", "ubuntu_linux_arm64_v8")
119+
120+
# This is what `rules_uv` really boils down to, so vendoring that
121+
bazel_dep(name = "rules_multitool", version = "0.11.0")
122+
123+
multitool = use_extension("@rules_multitool//multitool:extension.bzl", "multitool")
124+
multitool.hub(lockfile = "//uv/private/uv:uv.lock.json")
125+
use_repo(multitool, "multitool")
126+
127+
# Used as part of the sdist flow
128+
bazel_dep(name = "tar.bzl", version = "0.6.0")
129+
130+
# The toml tool that pip2 uses
131+
tomltool = use_extension("//uv/private/tomltool:extension.bzl", "tomltool")
132+
use_repo(
133+
tomltool,
134+
"aspect_rules_py_tomltool_aarch64_linux_gnu",
135+
"aspect_rules_py_tomltool_aarch64_linux_musl",
136+
"aspect_rules_py_tomltool_aarch64_osx_libsystem",
137+
"aspect_rules_py_tomltool_x86_64_linux_gnu",
138+
"aspect_rules_py_tomltool_x86_64_linux_musl",
139+
"aspect_rules_py_tomltool_x86_64_osx_libsystem",
140+
)
141+
142+
# Mandatory pip2 host configuration
143+
host = use_extension("//uv/private/host:extension.bzl", "host_platform")
144+
use_repo(host, "aspect_rules_py_pip_host")

docs/BUILD.bazel

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,13 @@ stardoc_with_diff_test(
3737
)
3838

3939
stardoc_with_diff_test(
40-
name = "venv",
41-
bzl_library_target = "//py/private/py_venv:py_venv",
40+
name = "unstable",
41+
bzl_library_target = "//py/unstable:defs",
42+
)
43+
44+
stardoc_with_diff_test(
45+
name = "uv",
46+
bzl_library_target = "//uv/private:extension",
4247
)
4348

4449
update_docs(name = "update")

docs/pip.md

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/py_binary.md

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/py_test.md

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/unstable.md

Whitespace-only changes.

e2e/uv-deps/BUILD.bazel

Whitespace-only changes.

e2e/uv-deps/MODULE.bazel

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
"Bazel dependencies"
2+
3+
bazel_dep(name = "aspect_rules_py", version = "0.0.0", dev_dependency = True)
4+
local_path_override(
5+
module_name = "aspect_rules_py",
6+
path = "../..",
7+
)
8+
9+
# Because we use a prerelease of rules_py, we must compile the rust tools from source.
10+
bazel_dep(name = "rules_rust", version = "0.53.0")
11+
12+
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
13+
rust.toolchain(
14+
edition = "2021",
15+
versions = ["1.81.0"],
16+
)
17+
use_repo(rust, "rust_toolchains")
18+
19+
register_toolchains("@rust_toolchains//:all")
20+
21+
bazel_dep(name = "rules_python", version = "0.29.0", dev_dependency = True)
22+
23+
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
24+
python.toolchain(
25+
configure_coverage_tool = True,
26+
python_version = "3.13",
27+
)
28+
python.toolchain(
29+
configure_coverage_tool = True,
30+
python_version = "3.11",
31+
)
32+
33+
# Testing
34+
uv = use_extension("@aspect_rules_py//uv:extension.bzl", "uv")
35+
uv.declare_hub(hub_name = "pip")
36+
uv.declare_venv(
37+
hub_name = "pip",
38+
venv_name = "default",
39+
)
40+
uv.lockfile(
41+
hub_name = "pip",
42+
lockfile = "//:uv-default.lock",
43+
venv_name = "default",
44+
)
45+
uv.declare_venv(
46+
hub_name = "pip",
47+
venv_name = "airflow",
48+
)
49+
uv.lockfile(
50+
hub_name = "pip",
51+
lockfile = "//:uv-airflow.lock",
52+
venv_name = "airflow",
53+
)
54+
use_repo(uv, "pip")

0 commit comments

Comments
 (0)