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

Support REPL command history. #2018

Merged
merged 8 commits into from
Jan 3, 2023
Merged

Support REPL command history. #2018

merged 8 commits into from
Jan 3, 2023

Conversation

benjyw
Copy link
Collaborator

@benjyw benjyw commented Dec 30, 2022

When running a REPL via Pex (e.g., with Pants's repl goal), it can be useful to support command history.

Python normally sets up command history by default when the interpreter imports site, but Pex bypasses that. So this change re-introduces the suggested idiom for loading and saving history, per https://docs.python.org/3/library/readline.html#example

Also replace a few hardcoded forward-slashed paths with os.path.sep.

@benjyw benjyw requested a review from jsirois December 30, 2022 18:18
@benjyw benjyw changed the title Support REPL history. Support REPL command history. Dec 30, 2022
@benjyw
Copy link
Collaborator Author

benjyw commented Dec 30, 2022

Addresses #2019

benjyw added 2 commits January 1, 2023 10:14
When running a REPL via Pex (e.g., with Pants's repl goal), it
can be useful to support command history.

Python normally sets up command history by default when the
interpreter imports `site`, but Pex bypasses that. So this
change re-introduces the suggested idiom for loading and
saving history, per https://docs.python.org/3/library/readline.html#example
@benjyw benjyw requested a review from jsirois January 2, 2023 14:10
@benjyw benjyw merged commit b2de657 into pex-tool:main Jan 3, 2023
@benjyw benjyw deleted the repl_history branch January 3, 2023 05:13
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.

3 participants