Python Venv
by @cikichen
Python environment management skill. Automatically detect project type and existing environments, recommend based on popularity. Minimize interruptions, only...
clawhub install python-venvπ About This Skill
name: python-venv description: "Python environment management skill. Automatically detect project type and existing environments, recommend based on popularity. Minimize interruptions, only ask when necessary."
Python Environment Management Skill
Core Principles
1. Reuse Existing Environments - Don't recreate, reuse existing virtual environments 2. Use Project-Type Decision - Auto-select based on lock files 3. Recommend by Popularity - uv > pip > conda > venv 4. Minimize Interruption - Only ask when necessary
Tool Popularity Ranking
| Priority | Tool | Best For | |----------|------|----------| | π₯ | uv | New projects, fast installs | | π₯ | pip | Compatibility first | | π₯ | conda | Data science, specific versions | | 4 | venv | Built-in, no extra install | | 5 | poetry | Existing poetry.lock | | 6 | pipenv | Existing Pipfile (declining) |
Decision Flow
βββββββββββββββββββββββββββββββββββββββ
β Detect project dependency files β
βββββββββββββββββββββββββββββββββββββββ
β
βββββββββββ΄ββββββββββ
β β
Clear decision Unclear
β β
Use directly Detect existing env
β
βββββββ΄ββββββ
β β
Has env No env
β β
Reuse Assess complexity
β
βββββββββββ΄ββββββββββ
β β
Simple task Needs deps
β β
System Python Recommend uv/conda
1. Clear Decisions (Execute Directly, No Ask)
When these files are detected, use the corresponding tool directly:
| Detected File | Execute |
|--------------|---------|
| uv.lock exists | uv sync or uv pip install -r requirements.txt |
| poetry.lock exists | poetry install |
| environment.yml exists | conda env create -f environment.yml |
| Pipfile.lock exists | pipenv install |
2. Detect Existing Environments (Reuse First)
# Priority: uv venv > conda > venv2.1 Detect uv virtual environment
ls -la .venv/ 2>/dev/null && uv pip list 2>/dev/null | head -32.2 Detect conda environment
conda info --envs 2>/dev/null | grep "*" || echo $CONDA_PREFIX2.3 Detect standard venv
ls -la venv/ .venv/ env/ 2>/dev/null2.4 If exists β Reuse (activate and run commands)
Reuse Example:
Detected existing .venv/ directory
β Activate: source .venv/bin/activate
β Run: uv pip install
3. When Unclear (Assess Complexity)
| Scenario | Action | |----------|--------| | Stdlib only, no 3rd party | System Python (python3) | | Simple pip install test | System Python (temp) | | Has requirements.txt | Recommend uv > pip > venv | | Has pyproject.toml | Recommend uv > pip | | Multi-file project, needs isolation | Recommend uv |
4. When to Ask User (Only These Cases)
β Ask: 1. Empty project + first dependency install β Ask which tool 2. Both requirements.txt + pyproject.toml β Ask which to use 3. User explicitly wants different tool β e.g., "I want conda"
β Don't Ask:
5. Recommended Tool (No Clear Directive)
First: uv
βββ uv venv (create)
βββ uv pip install (install)
βββ uv sync (sync)Backup: pip
βββ python3 -m venv .venv
βββ pip install
Special: conda
βββ conda create -n envname python=x.x
βββ conda env create
Detection Commands
# Check available tools
which uv
which conda
which pip
which python3Check project files
ls -la *.lock pyproject.toml requirements.txt environment.yml Pipfile 2>/dev/nullCheck existing environments
ls -la .venv/ venv/ env/ 2>/dev/null
conda info --envs 2>/dev/nullCheck current environment
echo $VIRTUAL_ENV
echo $CONDA_PREFIX
Interaction Examples (Only When Needed)
π Detection result:
Project file: pyproject.toml
Existing env: None
Recommended: uv (fastest) Running: uv pip install
π Detection result:
Project file: requirements.txt
Existing env: None
Recommended: uv Available options:
1) uv (recommended) - faster
2) pip - better compatibility
3) venv - uses stdlib
4) conda - if specific version needed
Enter option or press Enter to use recommended:
Quick Command Reference
| Action | uv | pip | conda | venv |
|--------|-----|-----|-------|------|
| Create env | uv venv | - | conda create | python3 -m venv |
| Install pkg | uv pip install | pip install | conda install | pip install |
| Install deps | uv sync | pip install -r | conda env create | pip install -r |
| Activate | (auto) | (auto) | conda activate | source venv/bin/activate |
Core Principle
"Do more, ask less" - Execute directly when you can determine, only ask when truly unclear.