Repository navigation
Conversation
Targets that install a Python package into a directory artifact (TreeArtifact) during the build phase cannot populate individual File objects in VenvSymlinkEntry.files when constructing virtual environment symlinks. Without sub-path metadata, overlapping package directories across multiple dependencies cannot be merged at file granularity. Add an experimental VenvSymlinkEntry.link_to_subpaths field (and builder support) so directory-backed entries can list their relative file paths for conflict merging, and teach virtual environment link generation to produce and merge TreeArtifact-backed entries. Single-file entries whose files holds an ancestor directory of link_to_path are now linked during conflict merging rather than skipped. Also prepare internal rule and tool helpers for build-action wheel installation with no change in default behavior: * Support multi-file bootstrap interpreter programs by staging sibling Python modules into a private directory with bytecode writing disabled. * Extract pure in-memory helpers for wheel RECORD and console-script shebang rewriting so build-time installers can reuse them directly.
|
This PR was AI-assisted: the code was written by an AI coding agent under my direction and went through several rounds of agent-driven review, including checks that default-mode behavior is unchanged. I've reviewed the final change. I'll handle review comments myself; any agent-drafted replies or follow-up changes will be reviewed by me before they're posted or pushed. |
|
PTAL |
|
@rsartor-cmd FYI some work Jeremy is doing related to sdist stuff |
rickeylev
left a comment
There was a problem hiding this comment.
Forgive me if my questions seem dumb. Its bit awhile since I was in venv_runfiles. I think I was following along, but I'm not entirely sure. The main thing I wasn't sure about is it seemed like the lists of File | str-path-within-directory are now being mixed, so i'm having a hard time following the "relativeness" of objects.
Drop the py_interpreter_program staging changes so it stays a thin bootstrap shim, normalize get_venv_symlinks inputs into typed candidate structs before grouping, clarify VenvSymlinkEntry and merge comments, fix MyST directive nesting, and rename the changelog fragment to 4396.
|
PTAL |
aignas
left a comment
There was a problem hiding this comment.
LGTM with a few questions.
Simplify the `files` expression on shared-library `VenvSymlinkEntry` records in `get_venv_symlinks`, document `tree_venv_lib` and `_assert_tree_artifact_equivalence`, and add `tree_shared_lib_loading_test` to verify loading compiled C extensions and transitive shared libraries from a `TreeArtifact`-backed venv at runtime.
Switch `tree_venv_merge_test` and `tree_shared_lib_loading_test` from `unittest.TestCase` + `py_reconfig_test` to `pytest_test` with plain `pytest` test functions and assertions.
An entry that is linked as a single unit (a directory File, or a path inside a directory artifact without link_to_subpaths) can't share its venv path with files from other entries. Such overlaps used to surface only when creating the runfiles tree, or produced an incorrect venv. Detect the overlap while merging and fail with the entries involved. Clarify in the VenvSymlinkEntry docs that link_to_subpaths is optional and what leaving it empty means.
Targets that install a Python package into a directory artifact
(TreeArtifact) during the build phase cannot populate individual File
objects in VenvSymlinkEntry.files when constructing virtual environment
symlinks. Without sub-path metadata, overlapping package directories
across multiple dependencies cannot be merged at file granularity.
Add an experimental VenvSymlinkEntry.link_to_subpaths field (and
builder support) so directory-backed entries can list their relative
file paths for conflict merging, and teach virtual environment link
generation to produce and merge TreeArtifact-backed entries.
Single-file entries whose files holds an ancestor directory of
link_to_path are now linked during conflict merging rather than
skipped.
Also extract pure in-memory helpers for wheel RECORD and console-script
shebang rewriting so build-time installers can reuse them directly with
no change in default behavior.