Skip to main content

A thin wrapper for uv with external venv management

Project description

prime-uve

PyPI version Python 3.13+ Tests Ruff uv

A thin wrapper for uv that provides seamless external venv management with automatic environment loading.

Why prime-uve?

For some project venv location is preferable outside the project root, on the local machine (e.g. if a project is save on a network share, venv should not be there for performance reasons). Tools like poetry do manage venv in a cache location, but uv does not easily: uv can read venv path from the environment variable UV_PROJECT_ENVIRONMENT, and the variable needs to be set for every subsequent uv call. Managing this manually is tedious and error-prone.

uv by default does not load environment variables from a .env, but it can run any command loading environment variables from a .env file with the --env-file <file> flag. Therefore this syntax is valid:

uv run --env-file <.env> -- uv [command]

prime-uve automates loading .env.uve for every command and provides tooling to manage venvs in a centralized location outside project roots.

As a side effect this tool also run uv with any environment variables the user decide to set in the .env.uve file.

Features

  • uve command - Alias for uv run --env-file .env.uve -- uv [command]
  • prime-uve CLI - Venv management with external venv locations
  • Automatic .env.uve discovery - Walks up directory tree to find config
  • Cross-platform paths - Uses expandable env variables ($HOME)
  • Centralized venv storage - Keep venvs organized outside project directories
  • Orphan detection - Track and clean up venvs from deleted projects

Installation

Install system-wide as a CLI tool:

uv tool install prime-uve

Quick Start

1. Initialize a project

cd your-project/
uv init # generate the pyproject.toml
prime-uve init 

This creates .env.uve with:

UV_PROJECT_ENVIRONMENT="$HOME/prime-uve/venvs/<project_name>_<hash>"

2. Use uve instead of uv

uve sync                    # Instead of: uv run --env-file .env.uve -- uv sync
uve add requests            # Instead of: uv run --env-file .env.uve -- uv add requests
uve run python script.py    # Instead of: uv run --env-file .env.uve -- uv run python script.py

.env.uve File Lookup

The lookup logic for .env.uve:

  1. Look for .env.uve in current directory
  2. If not found and cwd is not project root (no pyproject.toml), walk up the tree

This ensures commands work correctly from any subdirectory within your project.

Venv Management Commands

prime-uve list

List all managed venvs with validation:

  • Checks if projects still exist
  • Verifies paths match .env.uve mappings
  • Highlights orphaned venvs

prime-uve prune

Remove venvs from cache:

  • --all - Clean everything
  • --orphan - Clean only orphan venvs (deleted or moved projects)
  • path/to/venv - Clean specific venv
  • --current - Clean venv mapped to current project

Path Configuration

Venv paths use environment variables for cross-platform compatibility:

# path uses $env variables for cross-platform compatibility
UV_PROJECT_ENVIRONMENT="$HOME/prime-uve/venvs/<project_name>_<hash>"

The path includes:

  • Project name - From pyproject.toml
  • Short hash - Derived from project path to ensure uniqueness

Architecture

Current Status: Early development phase. Core commands implemented:

  • prime-uve init - Initialize project venv
  • prime-uve list - List managed venvs
  • prime-uve prune - Clean up orphaned venvs

License

MIT License - see LICENSE file for details.

Credits

Built on top of uv by Astral.

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

prime_uve-0.1.2.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prime_uve-0.1.2-py3-none-any.whl (31.2 kB view details)

Uploaded Python 3

File details

Details for the file prime_uve-0.1.2.tar.gz.

File metadata

  • Download URL: prime_uve-0.1.2.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for prime_uve-0.1.2.tar.gz
Algorithm Hash digest
SHA256 614b885dffe04f902ceda533255dc60f513b8680e820dad7152c6653c9b7134d
MD5 35da015d2165182c206871639db6cb92
BLAKE2b-256 35d0483127aa2caa0589b24ac549655dfa4afd231e083ab5f244d4962b178311

See more details on using hashes here.

Provenance

The following attestation bundles were made for prime_uve-0.1.2.tar.gz:

Publisher: release.yml on kompre/prime-uve

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file prime_uve-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: prime_uve-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 31.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for prime_uve-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d4b96d980284ef16d9c51f668bdfb2e6a679fd83a658adc55af71382e290d1e6
MD5 9aec945e57b9f5fae99347d138d92c2c
BLAKE2b-256 5de59de4d8db8c786d724ba3e246f8b6b75fd1841825b135b2960059011a2b3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for prime_uve-0.1.2-py3-none-any.whl:

Publisher: release.yml on kompre/prime-uve

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page