Skip to content
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

Merged
merged 3 commits into from Jul 21, 2020

Conversation

Eric-Arellano
Copy link
Contributor

Similar to #10410. Closes #10406.

[ci skip-rust-tests]

Comment on lines +63 to +72
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)},
)
Copy link
Contributor Author

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 "
Copy link
Contributor Author

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 :)

Copy link
Sponsor Member

@stuhood stuhood left a 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.

@Eric-Arellano
Copy link
Contributor Author

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 platforms.

@Eric-Arellano Eric-Arellano merged commit eca3ba7 into pantsbuild:master Jul 21, 2020
@Eric-Arellano Eric-Arellano deleted the faster-repl branch July 21, 2020 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No Pex overhead for changes to source files with run and repl
2 participants