Unify shell/run into a single plain python command#75
Open
davegaeddert wants to merge 1 commit into
Open
Conversation
Collapse `plain shell` (interactive REPL + `-c` + piped stdin) and
`plain run <script>` into one command that mirrors the `python`
interpreter, but always runs `plain.runtime.setup()` first:
plain python # interactive REPL (banner + SHELL_IMPORT)
plain python -c "..." # execute a string, then exit
plain python script.py # run a file as __main__
plain python - # execute stdin, then exit
echo ... | plain python # execute piped input
Enrichment (banner + SHELL_IMPORT auto-imports) stays confined to the
interactive REPL via PYTHONSTARTUP, matching how the interpreter only
honors PYTHONSTARTUP for interactive sessions — `-c`, file, and stdin
modes run code as-is. Args are a flat positional vector like the
interpreter's own argv, so `plain python script.py -c foo` forwards
`-c foo` to the script rather than capturing plain's own option, and
Plain's startup file wins over any user-exported PYTHONSTARTUP. All
interpreter modes run under `sys.executable`.
`plain shell` is kept as a thin shortcut to the interactive REPL (and,
like `plain python`, runs piped stdin with the app configured).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Ln7AFVxkkJTY78DfRfqWV
c9c1c56 to
4d6767b
Compare
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.
Collapse
plain shell(interactive REPL +-c+ piped stdin) andplain run <script>into one command that mirrors thepythoninterpreter, but always runs
plain.runtime.setup()first:Enrichment (banner + SHELL_IMPORT auto-imports) stays confined to the
interactive REPL via PYTHONSTARTUP, matching how the interpreter only
honors PYTHONSTARTUP for interactive sessions —
-c, file, and stdinmodes run code as-is. Args are a flat positional vector like the
interpreter's own argv, so
plain python script.py -c fooforwards-c footo the script rather than capturing plain's own option, andPlain's startup file wins over any user-exported PYTHONSTARTUP. All
interpreter modes run under
sys.executable.plain shellis kept as a thin shortcut to the interactive REPL (and,like
plain python, runs piped stdin with the app configured).Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_014Ln7AFVxkkJTY78DfRfqWV