Skip to main content

Project-level Python virtual environment management tool.

Project description

PyEM manages multiple virtual environments local to projects. It provides shortcuts to create, remove, switch between, and run commands against virtual environments created against various Python interpreters.

In Action

Add a virtual environment:

$ pyem venv add python3.7  # Based on a command.

$ pyem venv add 3.6  # Based on interpreter found by the Python launcher.

$ pyem venv add /usr/local/bin/pypy3  # Based on an executable.

List managed virtual environments:

$ pyem venv list
* pypy-3.6-darwin-x86_64-dc1298a1

Set active virtual environment:

$ pyem venv set 3.7
Switched to cpython-3.7-darwin-x86_64-dbe83ac5

$ pyem venv set 3.6
Error: name '3.6' is ambiguous; choose from:

$ pyem venv set cpython-3.6
Switched to cpython-3.6-darwin-x86_64-f14a3513

Run a command inside a virtual environment:

$ pyem poetry run python -c "import sys; print(sys.executable)"

$ pyem --spec=pypy-3.6 pipenv run pypy3 -c "import sys; print(sys.executable)"

How does this work?

Pryo sets environment variables VIRTUAL_ENV and PATH, and hand off control to subprocess for the command specified. This is enough to trick a lot of Python project tools, including the Python launcher, Poetry, and Pipenv.

Flit is more difficult to trick since it does not automatically inspect environment variables like other tools do. Use this workaround instead:

$ pyem flit install --python=python

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 pyem, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size pyem-0.1.1-py2.py3-none-any.whl (26.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size pyem-0.1.1.tar.gz (8.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page