How apw-labs/pyre-python-engine works
This Rust library bridges an IDE or other caller to Python environments: it discovers and validates interpreters, can create a virtual environment, and supervises Python execution with streamed output and timeout cleanup. The graph separates discovery sources, validation, environment creation, and process supervision. Internal calls are supported by the excerpts; the broader IDE workflow is documented in the README, and no IDE implementation is present in this repository.
Main entry points: interpreter.rs Interpreter scanner · supervisor.rs Process supervisor · lib.rs Public API · error.rs Engine errors
Components 15
Interpreter discovery
- Interpreter scanner
src/interpreter.rs - Workspace env scan
src/interpreter.rs - Conda discovery
src/interpreter.rs - pyenv discovery
src/interpreter.rs - PATH lookup
src/interpreter.rs - Candidate set
src/interpreter.rs - Interpreter validation
src/interpreter.rs
Environment management
- Venv manager
src/venv.rs
Process execution
- Process supervisor
src/supervisor.rs - Output stream pump
src/supervisor.rs
Shared API and errors
- Public API
src/lib.rs - Engine errors
src/error.rs
Other components
- IDE / caller
- Python executables
- Process tree
Connections 24
- IDE / caller → Interpreter scanner: requests discovery
README.md - Interpreter scanner → Workspace env scan: scans workspace
src/interpreter.rs - Interpreter scanner → Conda discovery: queries environments
src/interpreter.rs - Interpreter scanner → pyenv discovery: queries versions
src/interpreter.rs - Interpreter scanner → PATH lookup: looks up Python
src/interpreter.rs - Workspace env scan → Candidate set: adds candidates
src/interpreter.rs - Conda discovery → Candidate set: adds candidates
src/interpreter.rs - pyenv discovery → Candidate set: adds candidates
src/interpreter.rs - PATH lookup → Candidate set: adds candidates
src/interpreter.rs - Interpreter scanner → Interpreter validation: validates candidates
src/interpreter.rs - Interpreter validation → Python executables: runs inspection
src/interpreter.rs - IDE / caller → Venv manager: creates environment
- Venv manager → Python executables: runs venv module
src/venv.rs - IDE / caller → Process supervisor: spawns script
README.md - Process supervisor → Python executables: launches script
src/supervisor.rs - Process supervisor → Output stream pump: starts pumps
src/supervisor.rs - Output stream pump → Process supervisor: sends output
src/supervisor.rs - Process supervisor → Process tree: terminates on timeout
src/supervisor.rs - Process supervisor → Process tree: cleans up on drop
src/supervisor.rs - Public API → Interpreter scanner: exports
src/lib.rs - Public API → Process supervisor: exports
src/lib.rs - Public API → Engine errors: exports
src/lib.rs - Interpreter scanner → Engine errors: returns errors
src/interpreter.rs - Process supervisor → Engine errors: returns errors
src/supervisor.rs