Skip to content

fix(py_image_layer): support multiple binaries#1349

Closed
zbarsky-openai wants to merge 1 commit into
aspect-build:mainfrom
zbarsky-openai:zbarsky/py-image-layer-multi-binary
Closed

fix(py_image_layer): support multiple binaries#1349
zbarsky-openai wants to merge 1 commit into
aspect-build:mainfrom
zbarsky-openai:zbarsky/py-image-layer-multi-binary

Conversation

@zbarsky-openai

Copy link
Copy Markdown
Contributor

Summary

  • Preserve each binary launcher path while generating mtree entries.
  • Emit renamed launchers for additional binaries instead of only handling the primary binary.

Validation

  • bazel run //:buildifier -- /tmp/rules-py-image/py/private/py_image_layer.bzl
  • bazel build //py/private:py_image_layer

@CLAassistant

CLAassistant commented Jul 19, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@tamird tamird left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The multi-binary API needs a correctness guard and real execution coverage before this replaces the local patch. Different lock universes/interpreters can currently pass the plan comparison and then run a secondary launcher against the primary runtime; the public signature also breaks positional callers.


return _source_map

def _dependency_plan_signature(info):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This signature compares normalized package labels/layer groups and the interpreter group, not the actual wheel-install repository/version or interpreter identity. Two binaries from divergent lock universes can therefore compare equal, after which the secondary discards its own deps/interpreter and runs against the primary's runtime. Please compare the concrete runtime identities (or reject distinct install repos/interpreters) and add an e2e that executes both launchers plus a divergent-plan negative.

@@ -998,6 +1120,8 @@ _py_image_layer = rule(
def py_image_layer(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

additional_binaries and launcher_dir are inserted before the existing groups argument, so existing positional py_image_layer(...) calls silently rebind. Please append the new optional parameters after the established public arguments (or make the interface explicitly keyword-only without changing existing calls).

@jbedard
jbedard requested a review from thesayyn July 19, 2026 23:50
mandatory = True,
aspects = [_layer_aspect, _merge_aspect],
),
"additional_binaries": attr.label_list(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not a single binaries attribute and the macro can deal with binary|binaries|additional_binaries terminology while the real rule just gets the single list?

@tamird

tamird commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Reimplemented the multi-binary path independently in #1353. It unions concrete wheel, interpreter, and first-party artifacts across binaries, preserves the existing positional API, uses one inner binaries attribute, and executes two launchers across separate lock universes/Python versions. This addresses the three open design/correctness threads here.

@jbedard

jbedard commented Jul 23, 2026

Copy link
Copy Markdown
Member

Done in #1353

@jbedard jbedard closed this Jul 23, 2026
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.

4 participants