Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add repro example for platform downloads #2633

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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 examples/repro/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bazel-*
17 changes: 17 additions & 0 deletions examples/repro/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
load("@pip//:requirements.bzl", "all_requirements", "requirement")
load("@rules_python//python:defs.bzl", "py_test")
load("@rules_uv//uv:pip.bzl", "pip_compile")

pip_compile(
name = "generate_requirements",
python_platform = "aarch64-unknown-linux-gnu",
requirements_in = "requirements.in",
requirements_txt = "requirements.txt",
)

py_test(
name = "test",
srcs = ["test_load.py"],
main = "test_load.py",
deps = all_requirements,
)
35 changes: 35 additions & 0 deletions examples/repro/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module(
name = "platform_specific_deps",
version = "0.0.0",
compatibility_level = 1,
)

bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_python", version = "0.0.0")

# TODO: Replace with builtin uv support if it supports platform specific requirements output
bazel_dep(name = "rules_uv", version = "0.56.0")

local_path_override(
module_name = "rules_python",
path = "../..",
)

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

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
experimental_index_url = "https://pypi.org/simple", # use Bazel downloader
experimental_target_platforms = [
"linux_x86_64",
"linux_aarch64",
"osx_aarch64",
],
hub_name = "pip",
python_version = "3.12",
requirements_lock = "requirements.txt",
Comment on lines +26 to +33
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be commented in #2634.

)
use_repo(pip, "pip")
1 change: 1 addition & 0 deletions examples/repro/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
locust
Loading
Loading