Turn Python installations into venv-like environments that you can activate
Project description
venvify
Python package to turn Python installations into venv-like environments that you can activate.
Say you have the following python installation:
python_env
|- bin
| |- python3.9
|- include
|- lib
Then you can venvify it by running the following script:
venvify ~/python_env
The result:
python_env
|- bin
| |- python3.9
| |- python (symlink)
| |- python3 (symlink)
| |- activate
| |- activate.sh
| |- etc.
|- include
|- lib
Now you can source the activate file to use the environment as you would use a venv:
user@laptop: source python_env/bin/activate
(python_env) user@laptop: python -m pip install <some_package>
To undo the venvifying, simply remove the activate scripts and the symlinks from the bin directory.
Installation
All the logic of the package can be found in a single script venvify.py.
The only dependency is the venv Python standard library package.
venv should be shipped with Python 3, but can be installed with sudo apt install python3-venv.
So if you don't want to pip install, you can clone this repo and simply run venvify.py with any Python interpreter.
However if you don't mind you can:
pip install venvify
And then run the venvify command.
Use case: Blender Python environment
I made this package to make developing python scripts for Blender a bit more convenient.
Blender ships with its own Python installation.
But specifying the entire path to the Blender Python executable is tedious.
My initial solution was to add an alias bpython to my .bashrc.
This relieved the burden of typing long paths, but another problem remained.
Some Python packages come with command line entry points. For example, a package I use BlenderProc has a command blenderproc.
After installing BlenderProc into the Blender Python installation, there was no way access this command.
However, when you install such a package into a virtual environment, its commands are exposed after sourcing the created activate file.
Hence this package, which allowed me to activate the Blender Python environment and use the commands of the installed Python packages.
TODO
Maybe in the future this package could also ensure pip gets installed into the environment.
Project details
Release history Release notifications | RSS feed
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 venvify-0.0.2.tar.gz.
File metadata
- Download URL: venvify-0.0.2.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc171ada5a79281f1dbcd4fad6c6d0c9d99abd1f59a48d30fc97c1758933a69a
|
|
| MD5 |
946f5e54a7c1096d380654c56c69be8c
|
|
| BLAKE2b-256 |
eb209321d79e4e4bc6cb89c864f59ab987d504c35e01afe5f4cfb9cc12093efe
|
File details
Details for the file venvify-0.0.2-py3-none-any.whl.
File metadata
- Download URL: venvify-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b9f06215e982dd7e1219145f89aa070131f9f65755e96d3cf4a425afab2224d
|
|
| MD5 |
c6c61d265daac55bde3bbb353f487a63
|
|
| BLAKE2b-256 |
f566bb49e8fb2ae067d8b565904912e499af96bbc79a257647059655677018cc
|