Wrapper script for Python's venv
Project description
venvwrapper
venvwrapper is a Python package that provides commands that make it easier to manage Python virtual environments that are based on the venv package from the Python standard library.
Basically, venvwrapper is to venv what virtualenvwrapper is to virtualenv: It provides more convenient commands to make the management of virtual environments easier. However, virtualenv supports only a subset of the functionality of virtualenvwrapper.
venvwrapper combines nicely with virtualenvwrapper: The virtual environments created by both packages can reside in the same directory side by side, regardless which of the two created them. That allows you to gradually convert your existing virtualenv/virtualenvwrapper based environments to be based on venv.
Since Python 3.5, venv is the recommended tool for Python virtual environments, as stated in Creating virtual environments:
The use of venv is now recommended for creating virtual environments.
Also note this tweet by the BDFL on the topic:
I use venv (in the stdlib) and a bunch of shell aliases to quickly switch.
Supported shells
At this point, venvwrapper supports bash and zsh. More shells may work, but not with tab completion.
Contributions to add support for more shells are welcome!
Installation
-
Install the venvwrapper Python package into your default system Python 3 (i.e. with no virtual environment active):
$ pip3 install --break-system-packages venvwrapperThis installs the
venvwrapper.shscript so that it is available in the PATH.Note that this Python package has no Python dependencies, so it does not break your system Python in any way.
-
Verify that
venvwrapper.shis available in the PATH:$ which venvwrapper.sh /opt/homebrew/bin/venvwrapper.sh -
Add the following to your shell startup script (e.g.
~/.bash_profileor~/.zshrc) in a place where no Python virtual environment is active:# VENV_HOME=$HOME/.venv venv_wrapper=$(which venvwrapper.sh) if [[ -n $venv_wrapper ]]; then source $venv_wrapper fiVENV_HOMEspecifies the directory under which the directories for the virtual environments are created. If not set, it defaults to$HOME/.venv.VENV_HOMEcan be set to the same directory that is used for virtualenvwrapper (i.e. itsWORKON_HOMEdirectory). -
Verify the installation by starting a new terminal session, and invoking:
$ mkvenv --helpThis should display the help:
mkvenv - Create and activate a new Python virtual environment Usage: mkvenv ENV [PYTHON] Where: ENV Name of the new virtual environment PYTHON Python command to use for creation. Default: python3
Usage
All commands provided by venvwrapper explain their usage when called with -h
or --help:
venv- activate an existing virtual environmentmkvenv- create and activate a new virtual environmentrmvenv- remove one or more virtual environmentslsvenv- list existing virtual environments
The venv and rmvenv commands support tab completion.
The standard deactivate script provided by the virtual environment is used
to deactivate the current virtual environment.
An active virtual environment is indicated by an (env) prefix in the command
prompt. That is the normal behavior of venv.
The commands provided by venvwrapper are actually shell functions, so they
cannot be used in other scripts. If you need to activate virtual environments
in other scripts, call the activate script provided by the virtual
environment.
If venvwrapper is configured to use the same directory for its virtual
environments as virtualenv/virtualenvwrapper, then the commands that operate on
existing virtual environments can be used on either kind of virtual environment,
regardless of which package created it. For example, lsvenv will list both
kinds of virtual environments.
Development and contributions
The venvwrapper project welcomes contributions.
For how to set up a development environment, see DEVELOP.md.
References
The venvwrapper.sh script provided in this package is based on the script by Ismail Demirbilek at https://gist.github.com/dbtek/fb2ddccb18f0cf63a654ea2cc94c8f19.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file venvwrapper-0.9.0.tar.gz.
File metadata
- Download URL: venvwrapper-0.9.0.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a69083a8e8051facbc168ab8d207f0f354527f0fa0f674a93aa9fb061f8cebd
|
|
| MD5 |
27cc35f22cfc9b8afacd519d89a82acb
|
|
| BLAKE2b-256 |
9b713fbc4346e255496c546722e9f0ad94a41d7f96ed92c8461735e6f64ab38c
|
Provenance
The following attestation bundles were made for venvwrapper-0.9.0.tar.gz:
Publisher:
publish.yml on andy-maier/venvwrapper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
venvwrapper-0.9.0.tar.gz -
Subject digest:
7a69083a8e8051facbc168ab8d207f0f354527f0fa0f674a93aa9fb061f8cebd - Sigstore transparency entry: 155427880
- Sigstore integration time:
-
Permalink:
andy-maier/venvwrapper@1c521bffc503cdf255ae9f5472f3dd48368808b9 -
Branch / Tag:
refs/tags/0.9.0 - Owner: https://github.com/andy-maier
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1c521bffc503cdf255ae9f5472f3dd48368808b9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file venvwrapper-0.9.0-py3-none-any.whl.
File metadata
- Download URL: venvwrapper-0.9.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72578f5c389f1b46492b1587fa4cf7bcab510c3772f3f76262b3c45d87602833
|
|
| MD5 |
9b740d5f5b0559ccfcf0611bdb8523f3
|
|
| BLAKE2b-256 |
f5affe7e8842d6acab400f358399bbe6c59f9d0b5e572088c8f2276162ae660b
|
Provenance
The following attestation bundles were made for venvwrapper-0.9.0-py3-none-any.whl:
Publisher:
publish.yml on andy-maier/venvwrapper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
venvwrapper-0.9.0-py3-none-any.whl -
Subject digest:
72578f5c389f1b46492b1587fa4cf7bcab510c3772f3f76262b3c45d87602833 - Sigstore transparency entry: 155427882
- Sigstore integration time:
-
Permalink:
andy-maier/venvwrapper@1c521bffc503cdf255ae9f5472f3dd48368808b9 -
Branch / Tag:
refs/tags/0.9.0 - Owner: https://github.com/andy-maier
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1c521bffc503cdf255ae9f5472f3dd48368808b9 -
Trigger Event:
push
-
Statement type: