Tools to activate and run virtual environments from central location
Project description
uv-workon
Command line program uv-workon to work with multiple uv based virtual
environments.
Overview
uv has taken the python world by storm, and for good reason. It manages
projects, dependencies, virtual environment creation, and much more, all while
being blazingly fast. One of the central ideas of uv is that the old method of
activating virtual environments should be replace with uv run ... and letting
uv figure out the rest. We fully agree with this workflow, but it does run
counter to how many have used python virtual environments day to day for data
work. For example, many have historically used tools like conda or
virtualenvwrapper to manage centrally located python
environments, that can be reused for multiple tasks. While we discorage using
"mega" environments (i.e., sticking every dependency you'll ever need in a
single python environments), there is utility in using a virtual environment for
multiple tasks. There is active discussion regarding if
and how uv should manage centralized virtual environments.
We takes the perspective that python virtual environments should be managed with
uv inside a project. uv-workon allows for the usage of such virtual
environments outside the project. The basic workflow is as follows:
- Create a project
my-projectusinguv init ... - Create a virtual environment
my-project/.venvusinguv sync ... - Link to central location using
uv-workon link my-project
Now, from anywhere, you can use the virtual environment my-project:
- Activate with
uv-workon activate -n my-project - Run python using the
my-projectvirtual environment withuv-workon run -n my-project ... - Change to the
my-projectproject directory withuv-workon cd -n my-project
Features
- Link virtual environment to central location with
uv-workon link. These links are located atWORKON_HOMEenvironment variable, defaulting to~/.virtualenvs. - Activate virtual environment with
uv-workon activate ...(requires shell integration) - Run under virtual environment with
uv-workon run ... - Change to project directory with
uv-workon cd ...(requires shell integration) - List available virtual environments with
uv-workon list - Cleanup missing symlinks with
uv-workon clean - Manage
ipykernelwithuv-workon kernels ...- Install kernels for linked virtual environments which have
ipykernelinstalled withuv-workon kernels install ... - Remove kernels (including remove all missing/broken kernels) with
uv-workon kernels remove ... - list installed kernels with
uv-workon kernels list ...
- Install kernels for linked virtual environments which have
Status
This package is actively used by the author. Please feel free to create a pull request for wanted features and suggestions!
Quick start
It is recommended to install with uv:
uv tool install uv-workon
To include the ability to manage
ipykernel, include the jupyter
extra:
uv tool install "uv-workon[jupyter]"
Add autocompletion
Run the following to add autocompletion for uv-workon:
uv-workon --install-completion
Shell integration
To use uv-workon activate and uv-workon cd, you must enable the shell
configuration with `eval "$(uv-workon shell-config)", or add it to you config
script with:
# for zsh
echo 'eval "$(uv-workon shell-config)"' >> ~/.zshrc
# for bash
echo 'eval "$(uv-workon shell-config)"' >> ~/.bashrc
# for fish
echo 'uv-workon shell-config | source' >> ~/.config/fish/completions/uv-workon.fish
Open a issue if you need support for another shell.
Documentation
See the documentation for further details.
What's new?
See changelog.
License
This is free software. See LICENSE.
Related work
Any other stuff to mention....
Contact
The author can be reached at wpk@nist.gov.
Credits
This package was created using Cookiecutter with the usnistgov/cookiecutter-nist-python template.
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 uv_workon-0.7.4.tar.gz.
File metadata
- Download URL: uv_workon-0.7.4.tar.gz
- Upload date:
- Size: 23.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1439234cffe4879393e657f48f11377cc2092e666b8c79860b130c8f616e188a
|
|
| MD5 |
be9336628416567c9f75588fb5b51645
|
|
| BLAKE2b-256 |
0502fdd95920630766b0c3c36684d88525370f26449102d2cb5e3d16793a042c
|
Provenance
The following attestation bundles were made for uv_workon-0.7.4.tar.gz:
Publisher:
cd.yml on usnistgov/uv-workon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
uv_workon-0.7.4.tar.gz -
Subject digest:
1439234cffe4879393e657f48f11377cc2092e666b8c79860b130c8f616e188a - Sigstore transparency entry: 974002279
- Sigstore integration time:
-
Permalink:
usnistgov/uv-workon@25f6a5b6d45341272a84d6f689ac0617c3bc9e52 -
Branch / Tag:
refs/heads/feature/update-cd - Owner: https://github.com/usnistgov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@25f6a5b6d45341272a84d6f689ac0617c3bc9e52 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file uv_workon-0.7.4-py3-none-any.whl.
File metadata
- Download URL: uv_workon-0.7.4-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56de436bd6fe6696998c963bda9bb0d1485513e78dc8b07b0b65fcbc33920cbb
|
|
| MD5 |
51a8cd696ff62c3ea501cafafd212539
|
|
| BLAKE2b-256 |
3e1051f08a72460b3a133a60e424665df28876890a2ac6a87b36400b0e4c59da
|
Provenance
The following attestation bundles were made for uv_workon-0.7.4-py3-none-any.whl:
Publisher:
cd.yml on usnistgov/uv-workon
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
uv_workon-0.7.4-py3-none-any.whl -
Subject digest:
56de436bd6fe6696998c963bda9bb0d1485513e78dc8b07b0b65fcbc33920cbb - Sigstore transparency entry: 974002337
- Sigstore integration time:
-
Permalink:
usnistgov/uv-workon@25f6a5b6d45341272a84d6f689ac0617c3bc9e52 -
Branch / Tag:
refs/heads/feature/update-cd - Owner: https://github.com/usnistgov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@25f6a5b6d45341272a84d6f689ac0617c3bc9e52 -
Trigger Event:
workflow_dispatch
-
Statement type: