Skip to content

Commit ce948d7

Browse files
committed
Add repro example
1 parent fcf7221 commit ce948d7

File tree

6 files changed

+848
-0
lines changed

6 files changed

+848
-0
lines changed

examples/repro/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bazel-*

examples/repro/BUILD.bazel

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
load("@pip//:requirements.bzl", "all_requirements", "requirement")
2+
load("@rules_python//python:defs.bzl", "py_test")
3+
load("@rules_uv//uv:pip.bzl", "pip_compile")
4+
5+
pip_compile(
6+
name = "generate_requirements",
7+
python_platform = "aarch64-unknown-linux-gnu",
8+
requirements_in = "requirements.in",
9+
requirements_txt = "requirements.txt",
10+
)
11+
12+
py_test(
13+
name = "test",
14+
srcs = ["test_load.py"],
15+
main = "test_load.py",
16+
deps = all_requirements,
17+
)

examples/repro/MODULE.bazel

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
module(
2+
name = "platform_specific_deps",
3+
version = "0.0.0",
4+
compatibility_level = 1,
5+
)
6+
7+
bazel_dep(name = "bazel_skylib", version = "1.7.1")
8+
bazel_dep(name = "rules_python", version = "0.0.0")
9+
10+
# TODO: Replace with builtin uv support if it supports platform specific requirements output
11+
bazel_dep(name = "rules_uv", version = "0.56.0")
12+
13+
local_path_override(
14+
module_name = "rules_python",
15+
path = "../..",
16+
)
17+
18+
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
19+
python.toolchain(
20+
python_version = "3.12",
21+
)
22+
23+
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
24+
pip.parse(
25+
experimental_index_url = "https://pypi.org/simple", # use Bazel downloader
26+
experimental_target_platforms = [
27+
"linux_x86_64",
28+
"linux_aarch64",
29+
"osx_aarch64",
30+
],
31+
hub_name = "pip",
32+
python_version = "3.12",
33+
requirements_lock = "requirements.txt",
34+
)
35+
use_repo(pip, "pip")

examples/repro/requirements.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
locust

0 commit comments

Comments
 (0)