Skip to main content

venvs

PyPI version Supported Python versions Travis build status AppVeyor build status

venvs is a tool for configuring, in a single file, a set of virtualenvs, which packages to install into each, and any binaries to make globally available from within.

Installation

The usual:

$ pip install venvs

Usage

The best way to use venvs is by creating a file named ~/.local/share/virtualenvs/virtualenvs.toml. Here’s an example of what goes in it:

[virtualenv.development]
install = [
    "pudb",
    "twisted",
]
link = ["trial"]

[virtualenv.app]
install = ["$DEVELOPMENT/myapp"]

After creating the above, running venvs converge will create 2 virtualenvs, one called “development” with pudb and twisted installed into it and trial linked from within it onto your PATH, and a second called “app” installing the corresponding directory.

That’s about all you need to know. If you insist on reading further though, venvs has an older, not-very-recommended mutable interface which allows you to create virtualenvs in a central location without tracking them in a config file (or converging them). For that, usage is similar to mkvirtualenv, although venvs passes arguments directly through to virtualenv:

$ venvs create nameofvenv -- -p pypy

will create a virtual environment in an appropriate platform-specific data directory, or in the directory specified by WORKON_HOME for compatibility with virtualenvwrapper.

Single-Purpose Virtualenvs

A common use case for virtualenvs is for single-purpose installations, e.g.:

“I want to install fabric and give it its own virtualenv so that its dependencies can be independently upgraded, all while still being able to use the fab binary globally”.

venvs supports a --link option for this use case:

$ venvs create -i fabric --link fab

will create a virtualenv for fabric (in the same normal location), but will symlink the fab binary from within the virtualenv into your ~/.local/bin directory.

(You may have heard of pipsi which is a similar tool for this use case, but with less customization than I would have liked.)

Temporary Virtualenvs

I also find mktmpenv useful for quick testing. To support its use case, venvs currently supports a different but similar style of temporary virtualenv.

Invoking:

$ venv=$(venvs create -t)

in your shell will create (or re-create) a global temporary virtualenv, and print its bin/ subdirectory (which in this case will be then stored in the venv variable). It can subsequently be used by, e.g.:

$ $venv/python

or:

$ $venv/pip ...

et cetera.

You may prefer using:

$ cd $(venvs -t)

as your temporary venv workflow if you’re into that sort of thing instead.

The global virtualenv is cleared each time you invoke venvs -t. Unless you care, unlike virtualenvwrapper’s mktmpenv, there’s no need to care about cleaning it up, whenever it matters for the next time, it will be cleared and overwritten.

venvs may support the more similar “traditional” one-use virtualenv in the future, but given that it does not activate virtualenvs by default (see below), the current recommendation for this use case would be to simply use the virtualenv binary directly.

The 5 Minute Tutorial

Besides the venvs for named-virtualenv creation and venvs -t for temporary-virtualenv creation described above:

$ venvs find name foo

will output (to standard output) the path to a virtualenv with the given name (see also --existing-only), and:

$ venvs remove foo

will remove it.

There are a number of other slight variants, see the --help information for each of the three binaries.

Real documentation to come (I hope)

Why don’t I use virtualenvwrapper?

virtualenvwrapper is great! I’ve used it for a few years. But I’ve slowly settled on a much smaller subset of its functionality that I like to use. Specifically:

  • I don’t like activating virtualenvs.

    virtualenvs are magical and hacky enough on their own, and piling activation on top just makes things even more messy for me, especially when moving around between different projects in a shell. Some people use cd tricks to solve this, but I just want simplicity.

  • I don’t need project support.

    I’ve never attached a project to a virtualenv. I just use a naming convention, naming the virtualenv with the name of the repo (with simple coersion), and then using dynamic directory expansion in my shell to handle association.

Basically, I just want a thing that is managing a central repository of virtualenvs for me. So that’s what venvs does.

Metadata

Release files for venvs 6.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for venvs 6.1.0
File Size Uploaded
venvs-6.1.0.tar.gz 18.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for venvs 6.1.0
File Interpreter ABI Platform
venvs-6.1.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 37.7 kB

Release files / venvs-6.1.0.tar.gz

Download URL venvs-6.1.0.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ce467cb6cfe4a9d2f7e0ca3e552a6eb2631cc94fb39aeb8881205298b39a74e6
BLAKE2b-256 checksum
How to use checksums
ecf637ecf87924116241976a2a227680a59ae3552f7593580a7b7b222363dac7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 PyPy/7.1.1

Release files / venvs-6.1.0-py2.py3-none-any.whl

Download URL venvs-6.1.0-py2.py3-none-any.whl
Size 18.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
4ec9f306c21baecef8fac4265f2efef04cd16d0f6552695bc524b33714962b05
BLAKE2b-256 checksum
How to use checksums
8687a98f656d15c422bdda73b938abf5fb982366813ba76d8ee5767f9841b4ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 PyPy/7.1.1

Release history Release notifications | RSS feed

7.6.0

2 release files

7.5.1

2 release files

7.4.2

2 release files

7.4.0

2 release files

7.3.2

2 release files

7.3.1

2 release files

7.3.0

2 release files

7.1.2

2 release files

7.1.1

2 release files

7.1.0

2 release files

7.0.4

2 release files

7.0.3

2 release files

7.0.2

2 release files

7.0.1

2 release files

7.0.0

2 release files

6.12.4

2 release files

6.12.3

2 release files

6.12.2

2 release files

6.11.9

2 release files

6.11.8

2 release files

6.11.7

2 release files

6.11.6

2 release files

6.11.5

2 release files

6.11.4

2 release files

6.11.3

2 release files

6.11.2

2 release files

6.11.1

2 release files

6.10.2

2 release files

6.10.1

2 release files

6.9.0

2 release files

6.8.0

2 release files

6.7.1

2 release files

6.7.0

2 release files

6.6.0

2 release files

6.5.0

2 release files

6.4.1

2 release files

6.4.0

2 release files

6.3.0

2 release files

6.2.1

2 release files

6.2.0

2 release files

This release

6.1.0 This release

2 release files

6.0.1

2 release files

6.0.0

2 release files

5.1.0

2 release files

5.0.0

2 release files

4.2.0

2 release files

4.1.1

2 release files

4.1.0

2 release files

4.0.0

2 release files

3.12.0

2 release files

3.11.1

2 release files

3.11.0

2 release files

3.10.0

2 release files

3.9.0

2 release files

3.8.0

2 release files

3.7.0

2 release files

3.6.2

2 release files

3.6.1

2 release files

3.6.0

2 release files

3.5.1

2 release files

3.5.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page