uvn is conda for uv; a centralized Python virtual environment manager.
Project description
uvn
uvn
is a centralized Python virtual environment manager designed to work alongside uv
, similar to conda
for general environment management.
Highlights
- ๐ฏ Centralized Environments: Manage all environments from a single location.
- ๐ ๏ธ
uv
Integration: Complementsuv
to streamline virtual environment management. - โก๏ธ Simple CLI Interface: Easily list, create, activate, and remove environments with straightforward commands.
- ๐๏ธ Export Options: Quickly export configurations as
requirements.txt
or inline script metadata. - ๐พ Cloning: Easily clone environments to create new ones.
- ๐ Minimal Dependencies: Designed for simplicity and speed.
Installation
Install uv
first.
# On macOS and Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# On Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
[!CAUTION] Do not install
uv
viapip
; use the shell commands above.
Then, install uvn
with the cli
extra.
# From PyPI
uv tool install uvn[cli]
# From GitHub
uv tool install uvn[cli] @ git+https://github.com/xmodar/uvn
[!IMPORTANT] Although
uvn
can be installed viapip
, usinguv
is recommended for best integration.
Finally, install uvna
for easy shell activation (e.g., in ~/.bashrc
for bash
).
target="~/.bashrc"
uvna=$(cat <<'EOF'
uvna() {
activate=$(uvn activate --quiet "$1")
if [[ -n "$activate" ]]; then
eval "$activate"
else
uvn list
echo "Could not activate '"$1"'!" >&2
fi
}
EOF
)
target="${target/#\~/$HOME}"
if [[ -f "$target" ]] && grep -q "uvna() {" "$target"; then
sed -i "/^uvna() {/,/^}$/d" "$target"
fi
echo "$uvna" >> "$target"
source "$target"
[!TIP] Install shell completion (optional):
uvn --install-completion
Usage
After installing uvn
, manage virtual environments that are centralized and accessible from any directory, similar to conda
.
Quick Start
To begin, create and activate an environment.
uvn create test --python 3.12
uvna test
[!WARNING] Currently,
uvn activate <ENV_NAME>
only outputs the command for activation. Useuvna
or manually run the output command to activate.
The list
and remove
commands are simple.
# List environments with their sizes
uvn list --size
# Remove the 'test' environment
uvn remove test
To install packages, you can simply use uv pip
in an activated environment.
uvna test
uv pip install # ...
The export
command offers various options for exporting environment configurations.
# Print dependencies as in requirements.txt
uvn export test
# Export inline script metadata
uvn export test py --short --lower
# Generate a requirements.txt file
uvn export test requirements.txt
# Prepend inline script metadata (automatically detects ".py")
uvn export test script.py
# Clone the environment
uvn fork test test2
[!TIP] Use
--help
with any command to see available options.
Commands
Available commands in uvn
:
Usage: uvn [OPTIONS] COMMAND [ARGS]...
โญโ Commands โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
list List all virtual environments.
create Create a virtual environment.
remove Remove a virtual environment.
export Export a virtual environment.
fork Copy a virtual environment.
activate Show environment command.
version Show uvn version.
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Options โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
--install-completion Install completion for the current shell.
--show-completion Show completion for the current shell, to copy it or customize the installation.
--help Show this message and exit.
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
[!TIP] Commands support prefixes (e.g.,
uvn c
anduvn cr
are short foruvn create
).
[!NOTE] The location of virtual environments can be set by changing the
UVN_DIR
environment variable. The default path is~/.virtualenvs
.
Contributing
Contributions are welcome! For suggestions or issues, please submit a pull request or open an issue on GitHub.
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
File details
Details for the file uvn-0.1.0.tar.gz
.
File metadata
- Download URL: uvn-0.1.0.tar.gz
- Upload date:
- Size: 24.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.29
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80e2e2a4e39e8186ff89d2413699bc7717984258ce09eb237d6153092b6f8aaa |
|
MD5 | f424b9095d64a6bcabf7e24515c749ba |
|
BLAKE2b-256 | dacfe7a5444b3a1a6f2be2055cbceef42a991f3529815ee76f2f7159f333a997 |
File details
Details for the file uvn-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: uvn-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.29
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e874f73826a410959342c1dc9a6e636c123a613defa460a3c0a5c48c7a4d3f14 |
|
MD5 | a3a65337660923995a81de74520e03ce |
|
BLAKE2b-256 | 98c40b1ecf45b3849ea94d3efdb3a7d57432e0ee27f528cc9e437bb535ea2f27 |