Skip to main content

a lightweight python venv wrapper to manage venvs

Project description

pvw

A lightweight (~10kB) python venv wrapper for virtual environment management.

Based on the built-in venv since python 3.6.

Pre-requirement

  • Python >= 3.6
  • python-venv

Installation

pip install pvw

Usage

usage: pvw [-h] [-v] {ls,config,activate,create,rm,mv,cp} ...

Manage python venv environments.

positional arguments:
  {ls,config,activate,create,rm,mv,cp}
    ls                  list all venvs.
    config              get or set pvw config
    activate            activate venv.
                        For Linux/Mac:
                        Use `source pvw activate ENV_NAME` to activate venv
                        or simply use `source pvw ENV_NAME`.

                        For Windows:
                        use `pvw activate ENV_NAME`
                        or a shorter `pvw ENV_NAME`
    create              create a new venv.
    rm                  remove a venv.
    mv                  move(rename) venv to another place.
    cp                  copy venv.

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit

List venvs

pvw ls [--show-size]

List all created venvs, including name, path.

Adding --show-size modifier will show sizes, which may take a few seconds.

Name   Path                  Size
--------------------------------------
env1   C:\Users\venvs\env1   199.42MB
env2   C:\Users\venvs\env2   21.83MB
st     C:\Users\venvs\st     313.99MB
v2     C:\Users\venvs\v2     21.86MB
v3     C:\Users\venvs\v3     21.85MB

Get or set configs

Get or set the directory venv_path where venvs are stored.

pvw config get venv_path # get venv_path variable
pvw config set venv_path=PATH/TO/VENV # set venv_path

Create venv

pvw create ENV_NAME

Activate venv

For Windows, activate an existing venv with:

pvw activate ENV_NAME

or a shorter command:

pvw ENV_NAME

For Linux/Mac, activate venv with source command:

source pvw activate ENV_NAME

or for short:

source pvw ENV_NAME

Note: Shorter command only works on non-keywords venv names.

To deactivate, use deactivate inside environment. E.g. in Windows

(ENV_NAME) PS D:\Users> deactivate
PS D:\Users> 

Remove venv

pvw rm ENV_NAME_1 ENV_NAME_2 ENV_NAME_3 # support removing mutiple envs

Removal needs to be confirmed.

Move or rename venv

Move (or rename) env1 to a venv env2,

pvw mv env1 env2

Movement needs to be confirmed.

Note: the original venv would disappear.

Copy venv

Copy env1 to a new venv env2

pvw cp env1 env2

Build From Source

Using Makefile

cd src/pvw
make
sudo make install

The executable binary pvw and pvw_py will be installed in your /usr/bin/ directory.

Note that pyinstaller and termcolor will also be installed.

Using setuptools

pip install --upgrade build setuptools # skip if already installed
python -m build
pip install dist/pvw-x.x.x.tar.gz # x.x.x is the built version of pvw

To-do list

  • Customize venv path
  • init command for setting up a project
  • Simplify activate command in Linux/Mac OS
  • Enable setting default venv in terminal
  • Add unit tests
  • Support specific python version (if installed)

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

pvw-0.0.4.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

pvw-0.0.4-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file pvw-0.0.4.tar.gz.

File metadata

  • Download URL: pvw-0.0.4.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for pvw-0.0.4.tar.gz
Algorithm Hash digest
SHA256 a9f496d0a0328bcdae38d2eff8528721b8a457e0c7603ce2a1a76ba261a19297
MD5 0fe7bf26a6944ec610c22f280e58a637
BLAKE2b-256 bab816adafd9404973c0b67ff27e16cc7d272469fe774b4ce86ac686aca1ea1e

See more details on using hashes here.

File details

Details for the file pvw-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: pvw-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for pvw-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ade9745cb074a7f0d314095d368598b3413542fa7039f5501ee70cde8e772c62
MD5 91fe6a35750dce3898b4168bba75a429
BLAKE2b-256 1ee5a0d15df6b90d5e2a995645f39d02708f4d74c1beb7f21297fec525a0dbc0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page