Break mutual dependency between please_pex and test runners#266
Merged
chrisnovakovic merged 1 commit intoplease-build:masterfrom Oct 27, 2025
Merged
Conversation
The please_pex tool depends on various third-party modules for the built-in test runner bootstraps, which in turn require please_pex in order to be built. This circular dependency prevents the plugin from being built entirely from source - see please-build#265. The root cause of this circular dependency is the presence of the entry points in `//third_party/python:{behave,pytest}` - `python_wheel` doesn't require please_pex per se, but the use of the `binary` or `entry_points` parameters results in `python_binary` being used to build the outputs, which does require please_pex in order to make them executable. The entry points aren't actually necessary on these targets, though, because the generated .pex files aren't executed directly - they are just unzipped and concatenated onto the please_pex binary to form the bootstrap archive containing the built-in test runners and their transitive dependencies. Remove the `entry_points` parameters from the behave and pytest targets, and refactor the `//tools/please_pex` dependency tree so that the test runners and all of their transitive dependencies are present when the bootstrap archive is concatenated onto the main please_pex binary. The bootstrap archive's contents remain the same, with the following omissions: - `.bootstrap/plz.py` - This is written by please_pex when creating an executable .pex - its presence isn't meaningful or required in the bootstrap archive. - `.bootstrap/py/_vendored_packages/apipkg-2.0.0.dist-info/__init__.py` - `.bootstrap/py/_vendored_packages/iniconfig-1.1.1.dist-info/__init__.py` - These empty files were created by please_pex when creating the executable .pex for pytest - their presence isn't meaningful or required in the bootstrap archive. Fixes please-build#265.
toastwaffle
approved these changes
Oct 27, 2025
chrisnovakovic
added a commit
to chrisnovakovic/python-rules
that referenced
this pull request
Oct 27, 2025
The circular dependency between please_pex and its bootstrap archive was broken in please-build#266, allowing for the plugin to be configured to use `//tools_please_pex` as its own pex tool. This is simpler than building the please_pex binary in one step, copying it elsewhere in the file system for persistence, then configuring future steps to use that binary as the pex tool.
chrisnovakovic
added a commit
that referenced
this pull request
Oct 27, 2025
The circular dependency between please_pex and its bootstrap archive was broken in #266, allowing for the plugin to be configured to use `//tools/please_pex` as its pex tool. This is simpler than building the please_pex binary in one step, copying it elsewhere in the file system for persistence, then configuring future steps to use that binary as the pex tool.
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.
The please_pex tool depends on various third-party modules for the built-in test runner bootstraps, which in turn require please_pex in order to be built. This circular dependency prevents the plugin from being built entirely from source - see #265.
The root cause of this circular dependency is the presence of the entry points in
//third_party/python:{behave,pytest}-python_wheeldoesn't require please_pex per se, but the use of thebinaryorentry_pointsparameters results inpython_binarybeing used to build the outputs, which does require please_pex in order to make them executable. The entry points aren't actually necessary on these targets, though, because the generated .pex files aren't executed directly - they are just unzipped and concatenated onto the please_pex binary to form the bootstrap archive containing the built-in test runners and their transitive dependencies.Remove the
entry_pointsparameters from the behave and pytest targets, and refactor the//tools/please_pexdependency tree so that the test runners and all of their transitive dependencies are present when the bootstrap archive is concatenated onto the main please_pex binary.The bootstrap archive's contents remain the same, with the following omissions:
.bootstrap/plz.py.bootstrap/py/_vendored_packages/apipkg-2.0.0.dist-info/__init__.py.bootstrap/py/_vendored_packages/iniconfig-1.1.1.dist-info/__init__.pyFixes #265.