Skip to main content

Set of bash scripts that make bins installed in virtualenvs useful elsewhere.

Project description

Tools to install into a python virtualenv to make life easier. If you install virtualenv-bin into a virtualenv, you will get two useful programs.

venvbin

If you symlink to this program where it sits in a virtualenv and name the symlink for any program in the bin folder, executing the symlink will activate the virtualenv and then run the program, passing through all args and exit codes.

example

I want to install and use httpie, but I don’t want any of it’s dependencies interfering with my broader environment. Note: for this example, I use /opt/virtualenvs for all virtualenvs.

$ mkvirtualenv httpie
$ source /opt/virtualenvs/httpie/bin/activate
$ pip install --upgrade httpie
$ pip install virtualenv-bin
$ cd ~/bin
$ ln -s /opt/virtualenvs/httpie/bin/venvbin http
$ ~/bin/http example.org

HTTP/1.0 302 Found
Connection: Keep-Alive
Content-Length: 0
Location: http://www.iana.org/domains/example/
Server: BigIP

venvlaunch

Running this lets you execute a program that is inside a virtualenv directly

example

Here we are going to run http from directly inside the virtualenv.

$ mkvirtualenv httpie
$ source /opt/virtualenvs/httpie/bin/activate
$ pip install --upgrade httpie
$ pip install virtualenv-bin
$ cd ~/bin
$ /opt/virtualenvs/httpie/bin/venvsymlinks
$ ~/bin/http --help
$ /opt/virtualenvs/httpie/bin/venvlaunch http example.org

HTTP/1.0 302 Found
Connection: Keep-Alive
Content-Length: 0
Location: http://www.iana.org/domains/example/
Server: BigIP

installation

You can install virtualenv-bin using pip. There’s no point to installing this anywhere other then into a virtualenv you want to use it with.

$ pip install virtualenv-bin

Project details


Download files

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

Source Distribution

virtualenv-bin-0.9.1.tar.gz (2.3 kB view details)

Uploaded Source

File details

Details for the file virtualenv-bin-0.9.1.tar.gz.

File metadata

File hashes

Hashes for virtualenv-bin-0.9.1.tar.gz
Algorithm Hash digest
SHA256 b26953542f68c52d3cbde7abd7c4ada711b88b47c134fddbf51445a6e1750b94
MD5 cf28ed54beabf87ba61c33dc6f87f900
BLAKE2b-256 54ed5d64258df473c8a1fa5d85b2326c1a9893def9f37e816fa8a22d9a719f31

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page