Skip to content

Conversation

@ParaLock
Copy link

@ParaLock ParaLock commented Dec 29, 2025

Our use case of rules_py would benefit from an ability for binary targets to depend on other binary targets in a manner amenable to composition of virtual environments. This PR attempts to achieve said functionality by transitioning a binary into a library if it is depended upon by another binary.


Changes are visible to end-users: no

Test plan

  • Covered by existing test cases
  • New test cases added

@CLAassistant
Copy link

CLAassistant commented Dec 29, 2025

CLA assistant check
All committers have signed the CLA.

@aspect-workflows
Copy link

aspect-workflows bot commented Dec 29, 2025

test-os:linux-bzl:8 (Test)

⚠️ Buildkite build #1799 failed.

//py/unstable:defs.doc_extract failed to build

in deps attribute of starlark_doc_extract rule //py/unstable:defs.doc_extract: missing bzl_library targets
for Starlark module(s) //py/private:bin_to_lib.bzl. Since this rule was created by the macro 'bzl_library',
the error might have been caused by the macro implementation

//py:defs.doc_extract failed to build

in deps attribute of starlark_doc_extract rule //py:defs.doc_extract: missing bzl_library targets for
Starlark module(s) //py/private:bin_to_lib.bzl. Since this rule was created by the macro 'bzl_library', the
error might have been caused by the macro implementation

@@+uv+whl_install__pypi__default__bravado_core//:actual_install failed to build

unpack failed: error executing Action command (from target @@+uv+whl_install__pypi__default__bravado_core//:actual_install) bazel-out/k8-opt-exec-ST-a2b2cf5b3f92/bin/py/tools/unpack_bin/unpack --into bazel-out/k8-fastbuild/bin/external/+uv+whl_install__pypi__default__bravado_core/install --wheel ... (remaining 5 arguments skipped)
 
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
 
Error:   × Unable to run command:
  ├─▶ Didn't find exactly one wheel file to install!
  ╰─▶ got zero elements when exactly one was expected

//py/tests/py-binary:run_py_test_help failed to build

bash failed: error executing Genrule command (from target //py/tests/py-binary:run_py_test_help) /bin/bash -c ... (remaining 1 argument skipped)
 
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
 
Traceback (most recent call last):
  File "/mnt/ephemeral/output/rules_py/__main__/sandbox/linux-sandbox/5707/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/+uv+venv__pypi__default/pytest/entrypoints/pytest.runfiles/+uv+venv__pypi__default/pytest/entrypoints/_pytest_entrypoint.py", line 2, in <module>
    from pytest import console_main
ImportError: cannot import name 'console_main' from 'pytest' (unknown location)
Failed tests (5)
//py/tests/py_venv_image_layer:my_app_amd64_layers_test [k8-fastbuild]                    🔗
//py/tests/py_venv_image_layer:my_app_arm64_layers_test [k8-fastbuild]                    🔗
//py/tests/py_venv_image_layer:py_amd64_image_command_test [k8-fastbuild]                 🔗
//py/tests/py_venv_image_layer:py_amd64_image_content_test [k8-fastbuild]                 🔗
//py/tests/py_venv_image_layer:py_arm64_image_content_test [k8-fastbuild]                 🔗

💡 To reproduce the build failures, run

bazel build //py/unstable:defs.doc_extract //py:defs.doc_extract @@+uv+whl_install__pypi__default__bravado_core//:actual_install //py/tests/py-binary:run_py_test_help

💡 To reproduce the test failures, run

bazel test //py/tests/py_venv_image_layer:py_amd64_image_command_test //py/tests/py_venv_image_layer:py_arm64_image_content_test //py/tests/py_venv_image_layer:my_app_arm64_layers_test //py/tests/py_venv_image_layer:py_amd64_image_content_test //py/tests/py_venv_image_layer:my_app_amd64_layers_test

test-os:linux-bzl:latest (Test)

⚠️ Buildkite build #1799 failed.

//py/unstable:defs.doc_extract failed to build

in deps attribute of starlark_doc_extract rule //py/unstable:defs.doc_extract: missing bzl_library targets
for Starlark module(s) //py/private:bin_to_lib.bzl. Since this rule was created by the macro 'bzl_library',
the error might have been caused by the macro implementation

//py:defs.doc_extract failed to build

in deps attribute of starlark_doc_extract rule //py:defs.doc_extract: missing bzl_library targets for
Starlark module(s) //py/private:bin_to_lib.bzl. Since this rule was created by the macro 'bzl_library', the
error might have been caused by the macro implementation

//py/tests/py-binary:run_py_test_help failed to build

bash failed: error executing Genrule command (from target //py/tests/py-binary:run_py_test_help) /bin/bash -c ... (remaining 1 argument skipped)
 
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
 
Traceback (most recent call last):
  File "/mnt/ephemeral/output/rules_py/__main__/sandbox/linux-sandbox/5297/execroot/_main/bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/+uv+venv__pypi__default/pytest/entrypoints/pytest.runfiles/+uv+venv__pypi__default/pytest/entrypoints/_pytest_entrypoint.py", line 2, in <module>
    from pytest import console_main
ImportError: cannot import name 'console_main' from 'pytest' (unknown location)

@@+uv+whl_install__pypi__default__bravado_core//:actual_install failed to build

unpack failed: error executing Action command (from target @@+uv+whl_install__pypi__default__bravado_core//:actual_install) bazel-out/k8-opt-exec-ST-a2b2cf5b3f92/bin/py/tools/unpack_bin/unpack --into bazel-out/k8-fastbuild/bin/external/+uv+whl_install__pypi__default__bravado_core/install --wheel ... (remaining 5 arguments skipped)
 
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
 
Error:   × Unable to run command:
  ├─▶ Didn't find exactly one wheel file to install!
  ╰─▶ got zero elements when exactly one was expected
Failed tests (5)
//py/tests/py_venv_image_layer:my_app_amd64_layers_test [k8-fastbuild]                    🔗
//py/tests/py_venv_image_layer:my_app_arm64_layers_test [k8-fastbuild]                    🔗
//py/tests/py_venv_image_layer:py_amd64_image_command_test [k8-fastbuild]                 🔗
//py/tests/py_venv_image_layer:py_amd64_image_content_test [k8-fastbuild]                 🔗
//py/tests/py_venv_image_layer:py_arm64_image_content_test [k8-fastbuild]                 🔗

💡 To reproduce the build failures, run

bazel build //py/unstable:defs.doc_extract //py:defs.doc_extract //py/tests/py-binary:run_py_test_help @@+uv+whl_install__pypi__default__bravado_core//:actual_install

💡 To reproduce the test failures, run

bazel test //py/tests/py_venv_image_layer:my_app_amd64_layers_test //py/tests/py_venv_image_layer:my_app_arm64_layers_test //py/tests/py_venv_image_layer:py_arm64_image_content_test //py/tests/py_venv_image_layer:py_amd64_image_content_test //py/tests/py_venv_image_layer:py_amd64_image_command_test

test-os:linux-bzl:8 (Test)

e2e

⚠️ Buildkite build #1799 failed.

Failed tests (2)
//cases/uv-deps-650/crossbuild:app_amd64_layers_test [k8-fastbuild]                       🔗
//cases/uv-deps-650/crossbuild:app_arm64_layers_test [k8-fastbuild]                       🔗

💡 To reproduce the test failures, run

bazel test //cases/uv-deps-650/crossbuild:app_arm64_layers_test //cases/uv-deps-650/crossbuild:app_amd64_layers_test

test-os:linux-bzl:latest (Test)

e2e

⚠️ Buildkite build #1799 failed.

Failed tests (2)
//cases/uv-deps-650/crossbuild:app_amd64_layers_test [k8-fastbuild]                       🔗
//cases/uv-deps-650/crossbuild:app_arm64_layers_test [k8-fastbuild]                       🔗

💡 To reproduce the test failures, run

bazel test //cases/uv-deps-650/crossbuild:app_amd64_layers_test //cases/uv-deps-650/crossbuild:app_arm64_layers_test

test-os:linux-bzl:8 (Test)

examples/uv_pip_compile

All tests were cache hits

1 test (100.0%) was fully cached saving 335ms.


test-os:linux-bzl:latest (Test)

examples/uv_pip_compile

All tests were cache hits

1 test (100.0%) was fully cached saving 335ms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants