-
-
Notifications
You must be signed in to change notification settings - Fork 51
Description
What happened?
I have a prebuilt version of the av
pip library vendored into my monorepo. I use it like this:
load("@aspect_rules_py//py:defs.bzl", "py_library")
py_library(
name = "av",
srcs = glob(["av/**/*.py"]),
data = glob(
["av/**/*"],
exclude = ["av/**/*.py"],
),
imports = ["."],
visibility = ["//visibility:public"],
deps = [
],
)
The imports = ["."]
attribute is important for achieving the desired effect of allowing import av
to continue to 'just work' both under bazel and without bazel.
Recently we started making using of the py_venv
rule for some of our applications, and the imports
attribute continued propagating (so far, so good).
Now, I am trying to move our vendored av
into a cloud bucket (not changing any of the vendored contents, just moving them to the cloud), fetching it into bazel with http_archive
:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def _fetch_impl(_ctx):
http_archive(
name = "av_ubuntu22",
integrity = "sha256-XszyeidcIbrjcSx0AT4h/i2kdBq3h1+e3EhWXFZjaAM=",
url = "https://dev.pi-asset.com/av_prebuilt/ubuntu22_av_12_0_0.tar.xz",
build_file = "//third_party/av:BUILD.av",
)
av_prebuilt_extension = module_extension(
implementation = _fetch_impl,
)
With this change we started seeing failures when hitting the import av
line in our application.
In debugging, I tested all 4 combinations of [without_venv, with_venv] * [locally_vendored, http_archive]. The only combo that fails is with_venv + http_archive.
If it helps, I dumped sys.path
in each of the 4 cases. Here are the results:
without_venv + locally_vendored (works)
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/external/rules_python++python+python_3_11_x86_64-unknown-linux-gnu/lib/python311.zip
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/external/rules_python++python+python_3_11_x86_64-unknown-linux-gnu/lib/python3.11
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/external/rules_python++python+python_3_11_x86_64-unknown-linux-gnu/lib/python3.11/lib-dynload
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression.runfiles/.debug_compression.venv/lib/python3.11/site-packages
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression.runfiles
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression.runfiles/_main
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression.runfiles/_main/third_party/av
without_venv + http_archive (works)
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/external/rules_python++python+python_3_11_x86_64-unknown-linux-gnu/lib/python311.zip
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/external/rules_python++python+python_3_11_x86_64-unknown-linux-gnu/lib/python3.11
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/external/rules_python++python+python_3_11_x86_64-unknown-linux-gnu/lib/python3.11/lib-dynload
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression.runfiles/.debug_compression.venv/lib/python3.11/site-packages
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression.runfiles
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression.runfiles/_main
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression.runfiles/+av_prebuilt_extension+av_ubuntu22
with_venv + locally_vendored (works)
/teamspace/studios/this_studio/code/monopi/monopi/lib/py/video
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression_venv_binary.runfiles/rules_python++python+python_3_11_x86_64-unknown-linux-gnu/lib/python311.zip
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression_venv_binary.runfiles/rules_python++python+python_3_11_x86_64-unknown-linux-gnu/lib/python3.11
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression_venv_binary.runfiles/rules_python++python+python_3_11_x86_64-unknown-linux-gnu/lib/python3.11/lib-dynload
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression_venv_binary.runfiles/_main/monopi/lib/py/video/.debug_compression_venv/lib/python3.11/site-packages
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression_venv_binary.runfiles/_main
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression_venv_binary.runfiles/_main/third_party/av
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression_venv_binary.runfiles/rules_python++python+python_3_11_x86_64-unknown-linux-gnu/lib/python3.11/site-packages
with_venv + http_archive (fails)
/teamspace/studios/this_studio/code/monopi/monopi/lib/py/video
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression_venv_binary.runfiles/rules_python++python+python_3_11_x86_64-unknown-linux-gnu/lib/python311.zip
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression_venv_binary.runfiles/rules_python++python+python_3_11_x86_64-unknown-linux-gnu/lib/python3.11
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression_venv_binary.runfiles/rules_python++python+python_3_11_x86_64-unknown-linux-gnu/lib/python3.11/lib-dynload
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression_venv_binary.runfiles/_main/monopi/lib/py/video/.debug_compression_venv/lib/python3.11/site-packages
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression_venv_binary.runfiles/_main
/tmp/bazel/cb0ea8563d3be63a40f3bd12e6818456/execroot/_main/bazel-out/k8-fastbuild/bin/monopi/lib/py/video/debug_compression_venv_binary.runfiles/rules_python++python+python_3_11_x86_64-unknown-linux-gnu/lib/python3.11/site-packages
Version
Development (host) and target OS/architectures:
Output of bazel --version
: aspect 2025.12.21+723626945
Version of the Aspect rules, or other relevant rules from your
WORKSPACE
or MODULE.bazel
file: rules_python
1.4.1, aspect_rules_py
1.6.0
Language(s) and/or frameworks involved:
`
How to reproduce
Any other information?
No response