pi-uv
pi extension — auto-rewrites Python commands to execute inside a uv-managed virtual environment
Package details
$ pi install npm:pi-uv- Package
pi-uv- Version
0.1.0- Published
- Jun 9, 2026
- Downloads
- not available
- Author
- recall704
- License
- MIT
- Types
- extension
- Size
- 8.3 KB
- Dependencies
- 0 dependencies · 1 peer
Pi manifest JSON
{
"extensions": [
"./extensions/pi-uv.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-uv
A pi extension that auto-rewrites Python commands to execute inside a uv-managed virtual environment.
How it works
When you run Python commands via the bash tool, pi-uv intercepts the tool call and prepends uv run --project <project> so that:
- Commands run inside the correct project virtual environment
- Dependencies are resolved from
uv.lockrather than the system Python - No manual
.venvactivation needed
Project root detection
pi-uv automatically detects the uv project root using three strategies (in order):
- From the command argument path —
python3 project-a/main.py→ detects projectproject-a/ - Walk up from CWD — same algorithm as
uvitself - Scan CWD's immediate subdirectories — catches monorepo-style layouts
Once detected, it rewrites to uv run --project <root> <command>, which tells uv exactly where the project is without changing the command's working directory.
Installation
# Via npm
pi install npm:pi-uv
# Via git
pi install git:github.com/user/pi-uv
# Local development
pi -e ./extensions/pi-uv.ts
Requirements
- uv in
PATH(version 0.4+) - pi (version 0.x)
How to verify
# From inside a uv-managed project
python3 -c "import fastapi; print(fastapi.__version__)"
# The extension rewrites this to:
# uv run --project . python3 -c "import fastapi; print(fastapi.__version__)"
License
MIT