New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speed up repl
to no longer rebuild a Pex on source file changes
#10418
Conversation
[ci skip-rust-tests]
[ci skip-rust-tests]
[ci skip-rust-tests]
source_files_request = Get( | ||
UnstrippedPythonSources, UnstrippedPythonSourcesRequest(repl.targets) | ||
) | ||
pex, source_files = await MultiGet(pex_request, source_files_request) | ||
merged_digest = await Get(Digest, MergeDigests((pex.digest, source_files.snapshot.digest))) | ||
return ReplRequest( | ||
digest=merged_digest, | ||
binary_name=pex.output_filename, | ||
env={"PEX_EXTRA_SYS_PATH": ":".join(source_files.source_roots)}, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is duplicated from above. I tried factoring up, but it made things too complex because of needing to add a new request type.
@@ -32,7 +32,7 @@ async def run_python_binary( | |||
entry_point = PythonBinarySources.translate_source_file_to_entry_point(binary_sources.files) | |||
if entry_point is None: | |||
raise InvalidFieldException( | |||
"You must either specify `sources` or `entry_point` for the `python_binary` target " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the Target API, we can't be certain it's a python_binary
target :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks great.
Random aside: this usage of pex
(as a container for requirements, but not sources) feels quite close to a relocatable, self-contained virtualenv
.
That is the same mental model I'm using. And that it will allow you to use a specific entry point + constrain the interpreter via things like |
Similar to #10410. Closes #10406.
[ci skip-rust-tests]