Skip to main content

Adds the virtual environment's bin directory to PATH before executing a command

Project description

vrun

A small Python helper tool that will modify the PATH in the environment before executing the provided executable. This is useful when programs expect certain binaries to be available in PATH so they can execute them using os.popen() and friends or even for shell scripts that are executing Python tools that one would prefer to not globally install.

Scripts may detect that vrun has been used by looking for the environment variable VRUN_ACTIVATED which is set to 1 when run. It is not recommended that script writers do this.

Use

$ python3 -mvenv ./env/
$ ./env/bin/pip install vrun
$ ./env/bin/vrun /bin/bash -c 'echo $PATH'

If for example there is a script that executes pip without explicitly providing a PATH that includes a virtual environment the system installed pip may accidentally be invoked instead. With vrun the virtual environment will come first in the search path and thus pip will be safely executed within the context of the virtual environment.

$ ./env/bin/vrun ./myscript.sh

vrun or vexec

vrun installs itself as both vrun and vexec. The later may be typed with the left hand only and is slightly faster to roll off the keyboard!

License

Please see the LICENSE file in the source code repository

0.2 (2017-06-08)

  • Also export the environment variable VIRTUAL_ENV pointing to the virtual environment.

0.1 (2017-06-08)

  • Initial release and implementation of the vrun functionality

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for vrun, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size vrun-0.2-py2.py3-none-any.whl (7.2 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size vrun-0.2.tar.gz (5.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page