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.1.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.1-py3-none-any.whl (31.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: prime_uve-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 2c9d8fd95aa9c54e8f4ba0c90c053975c6f9cf821b011fab35fbcfefc56f2e77
MD5 1fd9ff61b54c4773352b87b65a7d9e7b
BLAKE2b-256 ac2f8cfd3af0944713073931219be807b79a6b51f761943d05a44ad50fbf1fc2

See more details on using hashes here.

Provenance

The following attestation bundles were made for prime_uve-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: prime_uve-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6f4325ce0ba6a9584ddec4016c91ec02f9e2b71815e62b93abe81f415ee3c027
MD5 50b1883845d1cda4fc15389f96657af0
BLAKE2b-256 2f65ce431f8a0ac935f3f452abfc49679547d53acbd5db385bb3d71af1649d5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for prime_uve-0.1.1-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