← 返回
开发者工具

Python Venv

Python environment management skill. Automatically detect project type and existing environments, recommend based on popularity. Minimize interruptions, only...
Python环境管理技能。自动检测项目类型和现有环境,基于流行度推荐。最小化中断,仅...
cikichen
开发者工具 clawhub v1.2.0 1 版本 99888.8 Key: 无需
★ 0
Stars
📥 898
下载
💾 150
安装
1
版本
#latest

概述

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

PriorityToolBest For
--------------------------
🥇uvNew projects, fast installs
🥈pipCompatibility first
🥉condaData science, specific versions
4venvBuilt-in, no extra install
5poetryExisting poetry.lock
6pipenvExisting 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 FileExecute
-----------------------
uv.lock existsuv sync or uv pip install -r requirements.txt
poetry.lock existspoetry install
environment.yml existsconda env create -f environment.yml
Pipfile.lock existspipenv install

2. Detect Existing Environments (Reuse First)

# Priority: uv venv > conda > venv

# 2.1 Detect uv virtual environment
ls -la .venv/ 2>/dev/null && uv pip list 2>/dev/null | head -3

# 2.2 Detect conda environment
conda info --envs 2>/dev/null | grep "*" || echo $CONDA_PREFIX

# 2.3 Detect standard venv
ls -la venv/ .venv/ env/ 2>/dev/null

# 2.4 If exists → Reuse (activate and run commands)

Reuse Example:

Detected existing .venv/ directory
→ Activate: source .venv/bin/activate
→ Run: uv pip install <package>

3. When Unclear (Assess Complexity)

ScenarioAction
------------------
Stdlib only, no 3rd partySystem Python (python3)
Simple pip install testSystem Python (temp)
Has requirements.txtRecommend uv > pip > venv
Has pyproject.tomlRecommend uv > pip
Multi-file project, needs isolationRecommend 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:

  • Has uv.lock but user didn't specify
  • Has .venv/ directory
  • Regular pip install task

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 python3

# Check project files
ls -la *.lock pyproject.toml requirements.txt environment.yml Pipfile 2>/dev/null

# Check existing environments
ls -la .venv/ venv/ env/ 2>/dev/null
conda info --envs 2>/dev/null

# Check 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 <package>
🔍 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

Actionuvpipcondavenv
-------------------------------
Create envuv venv-conda createpython3 -m venv
Install pkguv pip installpip installconda installpip install
Install depsuv syncpip install -rconda env createpip install -r
Activate(auto)(auto)conda activatesource venv/bin/activate

Core Principle

"Do more, ask less" - Execute directly when you can determine, only ask when truly unclear.

版本历史

共 1 个版本

  • v1.2.0 当前
    2026-03-19 11:21 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 67 📥 180,038
productivity

Structured Workflow

cikichen
默认启用:中文输出、结构化流程、简洁优先。适用于所有任务。
★ 0 📥 1,266
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,771