Skip to main content

a lightweight python venv wrapper to manage venvs

Project description

pvw

A lightweight 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

pvw [-h] {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.
    create              Create a new venv.
    rm                  Remove a venv.
    mv                  Move(rename) venv to another place.
    cp                  Copy venv.

You will be asked to set a venv_path to store venvs at the first time you use pvw.

List venvs

pvw ls [--show-size]

List all created venvs, including name, path and size. Note that size will only be displayed when the --show-size modifier is used, which would 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 simply use

pvw ENV_NAME

for short.

For Linux/Mac, activate venv with source command:

source pvw activate ENV_NAME

or simply use a shorter command

source pvw ENV_NAME

if your environment name is not conflict with our keywords.

To deactivate current venv, just type deactivate inside environment. E.g. in Windows

(ENV_NAME) PS D:\Users> deactivate

Use python, pip or any other commands inside environment as usual as in venv.

Remove venv

pvw rm env_name

You may be asked to confirm the venv to be removed.

Move or rename venv

Move env1 to a venv env2, the original venv would disappear.

pvw mv env1 env2

You may be asked to confirm the venv to be moved.

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
  • Simplify activate command in Linux/Mac OS
  • Enable setting default venv in terminal
  • Enable Editable installation (for dev)
  • Add unit tests

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.3.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pvw-0.0.3.tar.gz
  • Upload date:
  • Size: 10.0 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.3.tar.gz
Algorithm Hash digest
SHA256 4f193f28f8976743a5be9beb48b783dd3e7165f0a0e7e6b8186c0bd235bcef8e
MD5 6e081741d4ad927023df1b0097b35517
BLAKE2b-256 f80bf59cc19e51e1841ec9497867d88ee032202b87b4e8211cc0a4c39071ea8e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pvw-0.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 99df8967c0b51b55bc2cc0ca4e05587727e2dc36db1bbc5170acdccbeb577e24
MD5 9f628b194fca6acc52ba726e715f3b14
BLAKE2b-256 120137beb0a84e05d67ba475a82e7dec40fbe410ae0ca611acf8712953bc40b5

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