viv isn't venv
Find a file
2023-06-02 11:56:36 -05:00
.github/workflows docs: proper mkdocs and cli ref 2023-06-01 00:19:58 -05:00
assets chore: slightly modify logo 2023-05-29 13:32:09 -05:00
docs docs: update svgs 2023-06-01 15:56:01 -05:00
examples docs: update black shim with new standalone function 2023-06-01 09:51:15 -05:00
scripts docs: proper mkdocs and cli ref 2023-06-01 00:19:58 -05:00
src/viv fix: add vivenv arg back to info 2023-06-02 11:56:36 -05:00
.gitignore docs: proper mkdocs and cli ref 2023-06-01 00:19:58 -05:00
.pre-commit-config.yaml chore: try adding back pre-commit 2023-05-28 17:31:10 -05:00
.task.cfg.mk chore: change makefile style 2023-05-29 12:48:07 -05:00
LICENSE chore: add LICENSE 2022-12-26 08:03:58 -06:00
Makefile docs: update black shim with new standalone function 2023-06-01 09:51:15 -05:00
mkdocs.yml docs: proper mkdocs and cli ref 2023-06-01 00:19:58 -05:00
pdm.lock docs: proper mkdocs and cli ref 2023-06-01 00:19:58 -05:00
pyproject.toml docs: proper mkdocs and cli ref 2023-06-01 00:19:58 -05:00
README.md docs: remove some context from README.md 2023-06-02 11:53:42 -05:00
todo.md chore: clean up todo's 2023-05-27 16:45:05 -05:00

viv

Logo

viv isn't venv

Documentation

Try before you buy!

python3 <(curl -fsSL viv.dayl.in/viv.py) run pycowsay -- "viv isn't venv\!"

Viv is a standalone dependency-free venv creator.

Viv's uncompromising insistence on portability means that it will always:

  1. only use the standard library
  2. never exceed a single script.

For that reason any usage of the CLI can be accomplished using a remote copy as seen in the below install command.

Setup

Run the below command to install viv.

python3 <(curl -fsSL viv.dayl.in/viv.py) manage install

To access viv from within scripts you should add it's location to your PYTHONPATH. By default viv will be installed to $XDG_DATA_HOME/viv or ~/.local/share/viv you can customize this with --src.

export PYTHONPATH="$PYTHONPATH:$HOME/.local/share/viv"
pip install viv

Why is this not recommended? Mainly, because viv is all about hacking your sys.path. Placing it in it's own virtual environment or installing in a user site directory may complicate this endeavor.

Usage

In any python script with external dependencies you can add this line, to automate vivenv creation and installation of dependencies.

__import__("viv").use("click")

To remove all vivenvs you can use the below command:

viv remove $(viv list -q)

To remove viv all together you can use the included purge command:

python3 <(curl -fsSL viv.dayl.in/viv.py) manage purge

Additional Features

An experimental feature of viv is generating shim's that leverage the principles of viv. These shims would operate similar to pipx in which you can specify a command line app to "install".

Note that --standalone will auto-generate a mini function version of viv to accomplish the same basic task as using a local copy of viv. After generating this standalone shim you can freely use this script across unix machines which have python>3.8. See examples/black for output of below command.

python3 <(curl -fsSL viv.dayl.in/viv.py) shim black -o ./black --standalone --freeze

Alternatives

pip-run

pip-run (10.0.5)
├── autocommand (2.2.2)
├── jaraco-context (4.3.0)
├── jaraco-functools (3.6.0)
│   └── more-itertools (9.1.0)
├── jaraco-text (3.11.1)
│   ├── autocommand (2.2.2)
│   ├── inflect (6.0.2)
│   │   └── pydantic>=1.9.1 (1.10.5)
│   │       └── typing-extensions>=4.2.0 (4.5.0)
│   ├── jaraco-context>=4.1 (4.3.0)
│   ├── jaraco-functools (3.6.0)
│   │   └── more-itertools (9.1.0)
│   └── more-itertools (9.1.0)
├── more-itertools>=8.3 (9.1.0)
├── packaging (23.0)
├── path>=15.1 (16.6.0)
├── pip>=19.3 (23.0.1)
└── platformdirs (3.1.0)

pipx

pipx (1.1.0)
├── argcomplete>=1.9.4 (2.1.1)
├── packaging>=20.0 (23.0)
└── userpath>=1.6.0 (1.8.0)
    └── click (8.1.3)