Conversation
…runfiles `pyi_deps` are documented as build-time only dependencies for type checking and static analysis. Previously, `create_py_info` merged `pyi_deps` targets using `py_info.merge()`, which caused all transitive sources from type stubs and their dependencies to be placed in `PyInfo.transitive_sources` and included in downstream binary/test runfiles. This change updates `create_py_info` to only propagate `imports`, `transitive_pyi_files`, and `transitive_original_sources` from `pyi_deps`, preventing them from leaking into runtime runfiles. Adds unit tests verifying `transitive_sources` and binary runfiles exclusion.
pyi_deps in runtime runfilespyi_deps in runtime runfiles
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pyi_depsare documented as build-time only dependencies for type checking and static analysis, but currently leaks into the runfiles.Before:
create_py_infomergedpyi_depstargets usingpy_info.merge(), which caused all transitive sources from type stubs and their dependencies to be placed inPyInfo.transitive_sourcesand included in downstream binary/test runfiles.After:
create_py_infoonly propagatesimports(for module import resolution during type checking),transitive_pyi_files, andtransitive_original_sourcesfrompyi_deps. Adds unit tests verifyingtransitive_sourcesand binary runfiles exclusion.Tested: in our repo using
rules_pythonandpyi_depsfor type checking, this reduced the runfile tree size with 20M for a samplepy_test.