#python #launcher #interpreter #py #environment #args #virtual

app rpy

Run the appropriate python interpreter in the right way

4 releases

0.2.2 Oct 11, 2023
0.2.1 May 18, 2023
0.2.0 Mar 26, 2023
0.1.0 Dec 6, 2022

#797 in Command line utilities

Custom license

478 lines


Do you deal with lots of virtual python environments? rpy is for you!

Before rpy:

~/dev/prj$ env PYTHONPATH=src/py path/to/my/interpreter src/py/my/script.py --my --args here


~/dev/prj$ rpy src/py/my/script.py  --my --args here

The magic

rpy looks for a pyproject.toml file relating to the script, and then looks for a tool.py section of the form:

# All paths are relative to the project root (which is wherever we found the pyproject.toml
interpreter = 'out/env/bin/python'  # path relative to the project root
source_root = 'src/py'              # Optional PYTHONPATH to set up (defaults to project root)
pre_run = 'make --quiet deps'       # Optional command to run in the project root first


~103K SLoC