PYRS logo PYRS

Execution Modes

Edit this page

How PYRS runs code in REPL, stdin, module, script, command, and bytecode modes.

PYRS supports CPython-style execution entry points for interactive use, one-shot commands, module mode, script execution, stdin, and .pyc execution.

Mode Overview

Invocation Behavior
pyrsStarts interactive REPL when stdin/stdout are terminals.
pyrs (with piped stdin)Runs non-interactive stdin script input.
pyrs path/to/script.pyRuns source file and sets main.file.
pyrs path/to/module.pycExecutes CPython bytecode file through the VM bytecode path.
pyrs -m package.moduleResolves a library module from the current working directory/import path and runs it as a script.
pyrs -c ”…”Executes inline command string with CPython-shaped command mode semantics.

sys.argv Semantics

Mode sys.argv shape
Script mode[script_path, …script_args]
-c mode[“-c”, …args]
-m mode[resolved_module_origin, …module_args]
REPL/stdin mode[""]

Startup Controls

Control Effect
-S, —no-siteSkips automatic site import at startup.
-I, -EAccepted CPython compatibility flags; currently suppress only PYTHONWARNINGS ingest.
PYRS_CPYTHON_LIBSets explicit CPython stdlib root and enables strict startup-site import behavior.
PYTHONPATHAdditional module search entries are appended to the VM import path.
VIRTUAL_ENVDetected virtualenv site-packages paths are appended when present.

Practical Examples

Shell
$ pyrs -c "import sys; print(sys.argv)" one two $ pyrs -m http.server 8000 $ pyrs path/to/script.py arg1 arg2 $ pyrs -S path/to/script.py $ echo 'print(40 + 2)' | pyrs $ pyrs path/to/module.pyc