#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

19KB
478 lines

rpy

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

After:

~/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:

[tool.rpy]
# 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

Dependencies

~4–5.5MB
~103K SLoC