Skip to main content

vnv

vnv is a little shortcut for virtualenv that tries to stay out of your way. No more typing out . /path/to/env/bin/activate, now it's just vnv env.

Quickstart

Install. Then run:

vnv new my-venv
vnv my-venv

Bam. Now you're in a brand new virtualenv named "my-venv". It's cached right now, so you can toggle it off and on with just:

vnv

But what about your old virtualenvs? If you keep them all in a folder or two somewhere, just tell vnv where they are and you can activate them by name anywhere on your system:

$ export VNV_PATH="$HOME/old-envs"
$ cd anywhere
$ vnv my-old-env
(my-old-env) $

If not, you can always activate them by path:

$ vnv /path/to/a-venv
(a-venv) $

Features

Simple env toggling & caching

Shown above, vnv offers a shortcut for activating and deactivating virtualenv environments. Activating an env caches it for the current shell session, stored in $VNV_CACHED.

The vnv search path

You control where vnv finds envs to activate. The search path defaults to ~/.vnv/envs, but is overridden by $VNV_PATH.

$ vnv list
/home/gram/.vnv/envs:
  my-venv
$ export VNV_PATH="$HOME/old-envs:/path/to"
$ vnv list
/home/gram/old-envs:
  my-old-env
  flask-project
/path/to:
  a-venv

By default, vnv new creates envs in the first directory of the search path.

Activate by name, activate by path

When given a name like my-venv, vnv will only look for it on the vnv search path. To specify that "my-venv" is in the current directory, use the explicit path ./my-venv instead.

Shortcut, not a wrapper

Everything vnv does is just a shortcut to the default virtualenv behavior. Everything you make with it will still work even if you ditch vnv.

There are fancier tools out there for managing virtualenvs. Try virtualenvwrapper or pew for the wrapper experience.

Other features

  • Cross-platform and cross-shell
  • Multiple search path directories
  • Single 3-character command for everything
  • Create envs with $ vnv new, forwarding additional args to virtualenv
  • Manage envs with $ vnv list, $ vnv which, $ vnv del
  • Shortcut names: $ vnv m can activate my-venv
  • Supports activate_this.py with import vnv; vnv.activate('my-venv')

Installation

Use pip:

pip install vnv

Make sure to install vnv on your base Python installation, not in a virtual environment. You'll need access to it inside and outside of envs.

vnv supports 6 of the 7 activators virtualenv supports, meaning it works with bash/zsh/ksh, cmd.exe, csh, fish, PowerShell, and the Python interpreter itself.

If you use one of those that ends in "sh", you'll also need to load the corresponding wrapper script in your startup file. For example, bash requires the line . vnv-init in ~/.bashrc. Instructions included.

Some more ideas

If you want to have a default env, you could pre-set $VNV_CACHED to its location when your shell starts. Use your startup file (or the environment variables on Windows).

If you want to activate envs in the current directory by name, add . to the vnv search path.

vnv search path folders don't have to only contain virtualenvs. If you keep an env alongside other stuff in a project folder, it's fine to add the whole project folder to $VNV_PATH.

Release files for vnv 2.1

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

Source distribution (sdist)

Source distribution for vnv 2.1
File Size Uploaded
vnv-2.1.tar.gz 13.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vnv 2.1
File Interpreter ABI Platform
vnv-2.1-py3-none-any.whl Python 3 none any Details

Total release size: 27.3 kB

Release files / vnv-2.1.tar.gz

Download URL vnv-2.1.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c06cd8b1d7df3b1e19b3890e603e5c56092df50838293ee7651a791a14227777
BLAKE2b-256 checksum
How to use checksums
2d7f068961c26a2e020e4d8d839da200b11a2868486e04ff5c6c335c990a8a88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release files / vnv-2.1-py3-none-any.whl

Download URL vnv-2.1-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30198fd877d3ff1dd181da40542a6aedf9878d05aa1e74e86548938940a8e3fd
BLAKE2b-256 checksum
How to use checksums
fe9034a203a07054afb826eb2118a2f117fc46c6df57bc5005a12308efbb5f45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release history Release notifications | RSS feed

This release

2.1 This release

2 release files

2.0

1 release file

1.2

2 release files

1.1

2 release files

1.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.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