Skip to content

Commit cb06830

Browse files
committed
feat(uv): Create a UV driver
1 parent 685eb0f commit cb06830

Some content is hidden

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

59 files changed

+5361
-84
lines changed

.bcr/patches/remove_dev_deps.patch

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
--- a/MODULE.bazel 2025-10-28 13:13:30
2-
+++ b/MODULE.bazel 2025-10-28 13:13:30
3-
@@ -22,557 +22,5 @@
4-
"@aspect_rules_py//py/private/toolchain/venv/...",
5-
"@aspect_rules_py//py/private/toolchain/unpack/...",
6-
"@aspect_rules_py//py/private/toolchain/shim/...",
7-
-)
1+
--- a/MODULE.bazel 2025-10-28 13:23:40
2+
+++ b/MODULE.bazel 2025-10-28 13:23:40
3+
@@ -37,556 +37,4 @@
4+
5+
host = use_extension("//uv/private/host:extension.bzl", "host_platform")
6+
use_repo(host, "aspect_rules_py_uv_host")
87
-
98
-################################################################################
109
-# Dev deps
@@ -293,7 +292,7 @@
293292
- ],
294293
- target_triple = "x86_64-unknown-linux-musl",
295294
- versions = [RUST_VERSION], # "versions" only set in first instance of "rust_darwin_x86_64" repository_set (see comment above)
296-
)
295+
-)
297296

298297
-# -> linux arm (musl)
299298
-rust.repository_set(

MODULE.bazel

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@ register_toolchains(
2424
"@aspect_rules_py//py/private/toolchain/shim/...",
2525
)
2626

27+
toml = use_extension("//uv/private/tomltool:extension.bzl", "tomltool")
28+
use_repo(
29+
toml,
30+
"aspect_rules_py_tomltool_aarch64_osx_libsystem",
31+
"aspect_rules_py_tomltool_x86_64_osx_libsystem",
32+
"aspect_rules_py_tomltool_aarch64_linux_gnu",
33+
"aspect_rules_py_tomltool_aarch64_linux_musl",
34+
"aspect_rules_py_tomltool_x86_64_linux_gnu",
35+
"aspect_rules_py_tomltool_x86_64_linux_musl",
36+
)
37+
38+
host = use_extension("//uv/private/host:extension.bzl", "host_platform")
39+
use_repo(host, "aspect_rules_py_uv_host")
40+
2741
################################################################################
2842
# Dev deps
2943
#

e2e/MODULE.bazel

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,27 @@ local_repository(
6868
# For cases/repository-rule-deps-299
6969
importer = use_extension("//cases/repository-rule-deps-299/rules:import.bzl", "importer")
7070
use_repo(importer, "myrepo")
71+
72+
# For cases/uv-deps-650
73+
uv = use_extension("@aspect_rules_py//uv:extension.bzl", "uv")
74+
uv.declare_hub(hub_name = "pypi")
75+
uv.declare_venv(
76+
hub_name = "pypi",
77+
venv_name = "default",
78+
)
79+
uv.lockfile(
80+
hub_name = "pypi",
81+
lockfile = "//cases/uv-deps-650:uv-default.lock",
82+
venv_name = "default",
83+
)
84+
uv.declare_venv(
85+
hub_name = "pypi",
86+
venv_name = "airflow",
87+
)
88+
uv.lockfile(
89+
hub_name = "pypi",
90+
lockfile = "//cases/uv-deps-650:uv-airflow.lock",
91+
venv_name = "airflow",
92+
)
93+
use_repo(uv, "pypi")
94+

e2e/cases/uv-deps-650/BUILD.bazel

Whitespace-only changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.11
3+
# by the following command:
4+
#
5+
# bazel run //:requirements.update
6+
#
7+
cowsay==6.1 \
8+
--hash=sha256:274b1e6fc1b966d53976333eb90ac94cb07a450a700b455af9fbdf882244b30a
9+
# via -r requirements.in
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
load("@aspect_rules_py//py/unstable:defs.bzl", "py_venv_test")
2+
3+
py_venv_test(
4+
name = "airflow",
5+
srcs = [
6+
"__test__.py",
7+
],
8+
main = "__test__.py",
9+
python_version = "3.13",
10+
venv = "airflow",
11+
deps = [
12+
"@pypi//apache_airflow",
13+
],
14+
)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env python3
2+
3+
# TODO: Deprecated API, need an alternative
4+
import pkgutil
5+
assert "tests/airflow/.airflow/" in pkgutil.get_loader("airflow").get_filename()
6+
7+
import sys
8+
assert sys.version_info.major == 3
9+
assert sys.version_info.minor == 13
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
load("@aspect_rules_py//py/unstable:defs.bzl", "py_venv_test")
2+
3+
py_venv_test(
4+
name = "say",
5+
srcs = [
6+
"__test__.py",
7+
],
8+
main = "__test__.py",
9+
python_version = "3.11",
10+
venv = "default",
11+
deps = [
12+
"@pypi//cowsay",
13+
],
14+
)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env python3
2+
3+
import cowsay
4+
assert "tests/say/.say/" in cowsay.__file__
5+
6+
import sys
7+
assert sys.version_info.major == 3
8+
assert sys.version_info.minor == 11

0 commit comments

Comments
 (0)