venvx
Create and use virtual environments with ease
Installation
Install the venvx package with pip
python -m pip install --user venvx
or your favorite Python package manager. To install the venv shell extension, enter
venvx shellext > ~/.venvx.sh
Review the content of the file and source it into your bash or zsh profile.
Usage
Assuming the current directory contains two virtual enviroments called .venv3.10 and .venv3.11:
% ls -a
./ ../ .venv3.10/ .venv3.11/
The command venv use activates, and switches between, virtual environments.
% venv use .venv3.10
(.venv3.10) % which pip
/path/to/.venv3.10/bin/pip
If the venv name begins with .venv, it suffices to specify the remainder of the name. For instance, in order to switch to another virtual enviroment:
(.venv3.10) % venv use 3.11
(.venv3.11) % which pip
/path/to/.venv3.11/bin/pip
To quickly run a command in a virtual environment, use the run command.
(.venv3.11) % venv run 3.10 which python
/path/to/.venv3.10/bin/python
(.venv3.11) %
Since venv always activates the virtual environment internally, venv commands may be run within another virtual environment as shown above, or outside:
(.venv3.11) % venv off
% venv run 3.10 pytest -v tests
%
New virtual environments can be created with venv create. If the name of the virtual environment is omitted, ".venv" will be used:
% venv create
or use a different name e.g.
% venv create pyenv
The Python version to use within the new virtual environment may be specified with the -v (a.k.a. --versions) option.
% mkdir newdir && cd newdir
% venv create -v 3.8 3.9
% venv create pyenv -v 3.8 3.9
% ls -a
./ ../ .venv3.8/ .venv3.9/ pyenv3.8/ pyenv3.9/
The new virtual environments have already been upgraded to the most recent version of the pip package. The command
% venv upgrade-pip existing_env
upgrades the pip module of an existing virtual environment. Obviously, this works in an activated virtual enviroment as well.
% venv use 3.9
(.venv3.9) % venv upgrade-pip
In Git Bash on Windows, the Scripts/activate script defines a VIRTUAL_ENV path that contains both "/" and "\" path separators. venv fix [path] corrects that.
When a virtual environment is copied to a different location, the activate script's VIRTUAL_ENV setting, as well as the shebangs in the various scripts within the venv's bin/ folder, all still refer to the original virtual environment. venv fix [path] performs the necessary updates. Example (Darwin or Linux):
% mv .venv3.9 .venv39
% venv fix 39
Checking if any scripts require patches - yes (6)
Fixing the shebang in pip3 - done
Fixing the shebang in pip - done
Fixing the shebang in pip3.9 - done
Fixing the VIRTUAL_ENV setting in activate.fish - done
Fixing the VIRTUAL_ENV setting in activate - done
Fixing the VIRTUAL_ENV setting in activate.csh - done
Enter venv help and venvx -h for more information on usage.
Metadata
Release files for venvx 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| venvx-0.4.0.tar.gz | 26.6 kB | Without provenance | Details for venvx-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| venvx-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for venvx-0.4.0-py3-none-any.whl |
Total release size: 45.6 kB
Release files / venvx-0.4.0.tar.gz
| Download URL | venvx-0.4.0.tar.gz |
|---|---|
| Size | 26.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f79184fe7ea2c94228bf19123639ebd050d370dacc50673fa82c4770934348cb
|
|
BLAKE2b-256 checksum How to use checksums |
15e277aee7f3dde694eae0521d479f28468fc890d52fd19f23a0851f5159dc51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|
Release files / venvx-0.4.0-py3-none-any.whl
| Download URL | venvx-0.4.0-py3-none-any.whl |
|---|---|
| Size | 19.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6d2a22397a12dcc1138b3be5f5391458749e08c8cf13e482eb324e67939aed64
|
|
BLAKE2b-256 checksum How to use checksums |
16c3c5a8bf002d6ce17cd1240e040adb4a0199655297a864ce92024394b8df70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.31.0
|
Security for venvx 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.