Skip to content

Add DepsTraversalBehavior(Enum) and some docstrings#19387

Merged
cognifloyd merged 3 commits intomainfrom
cognifloyd/package-deps-traversal
Jun 27, 2023
Merged

Add DepsTraversalBehavior(Enum) and some docstrings#19387
cognifloyd merged 3 commits intomainfrom
cognifloyd/package-deps-traversal

Conversation

@cognifloyd
Copy link
Member

This addresses feedback from #19306 (review)

The ShouldTraverseDepsPredicate returned a bool before. But, the bool was sometimes unclear, so this adds an enum to make the code more readable.

NB: The values of the enum are not important.

This is marked as internal because it's a refactor for a 2.18.x feature that hasn't been released yet.

@cognifloyd cognifloyd added the category:internal CI, fixes for not-yet-released features, etc. label Jun 27, 2023
@cognifloyd cognifloyd requested review from stuhood and thejcannon June 27, 2023 18:28
@cognifloyd cognifloyd self-assigned this Jun 27, 2023
@cognifloyd cognifloyd changed the title Add DepsTraversalBehavior(Enum) and some documentation Add DepsTraversalBehavior(Enum) and some docstrings Jun 27, 2023
Copy link
Member

@thejcannon thejcannon left a comment

Choose a reason for hiding this comment

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

Amazing

@cognifloyd cognifloyd enabled auto-merge (squash) June 27, 2023 19:26
@cognifloyd cognifloyd merged commit 361a665 into main Jun 27, 2023
@cognifloyd cognifloyd deleted the cognifloyd/package-deps-traversal branch June 27, 2023 21:21
cognifloyd added a commit that referenced this pull request Jul 15, 2023
…19155)

This builds on:
- #19272
- #19306
- #19387

This only updates the `pex_binary` rule to use the new
`TraverseIfNotPackageTarget` predicate when requesting the source files
that should be included in this pex. Wheels, other pex_binaries, and
other package targets are not handled via this code path since those are
not python sources that get included in the pex based on the
`include_sources` flag.

Fixes #15855

This fixes #15855 because anything in a `python_distribution` does not
need to be included as a source file in the `pex_binary`. wheels get
included via the `LocalDists` rules. In some cases, we might still get
more sources in the pex than intended. This might happen if a dependency
is inferred between sources, bypassing the logic that looks for wheels
that own the relevant things. In any case, this is PR provides an
improvement and resolves the sample error in #15855.

Related:
- #18254
- #17368
- #15082

---------

Co-authored-by: Joshua Cannon <joshdcannon@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category:internal CI, fixes for not-yet-released features, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants