Skip to main content

A simpler tool for creating venvs in a central location

Project description

mkenv is a simpler tool for creating virtualenvs in a central location.

It consists of the 5% of virtualenvwrapper that I actually use, and is in some ways meant to complement virtualenv rather than completely wrapping or hiding it.

Installation

The usual:

$ pip install mkenv

Usage

Usage is similar to mkvirtualenv, although mkenv passes arguments directly through to virtualenv:

$ mkenv 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.

Temporary Virtualenvs

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

Invoking:

$ venv=$(mkenv -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.

The global virtualenv is cleared each time you invoke mkenv -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.

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

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, especially if you’re moving around between different projects in a shell. Some people use cd tricks to solve this, but I just want simiplicity.

  • 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 mkenv does!

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkenv-0.2.0-py2-none-any.whl (6.8 kB view details)

Uploaded Python 2

File details

Details for the file mkenv-0.2.0-py2-none-any.whl.

File metadata

File hashes

Hashes for mkenv-0.2.0-py2-none-any.whl
Algorithm Hash digest
SHA256 63fb3f64138db618a5e81f608bcbb4779cf56c42185affc46c6bcd1c2e1a20ad
MD5 0cd594774aa27b5cd51737ebaa4d9e91
BLAKE2b-256 82238935039589ac079690f1310ef484015d4e8abf86682575df193b8385c373

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