setup-env
When given a Python project codebase, this skill helps the agent to set up virtual environments, install dependencies, and run scripts.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Skill: Use uv to manage Python environments
Scope
- Create a virtual environment
- Install dependencies
- Run Python scripts/commands
Assume uv is already available on PATH.
Workflow selection
- If
pyproject.tomlexists: use project workflow (uv sync,uv run) - Else if
requirements.txtexists: use pip workflow (uv venv,uv pip install -r ...,.venv/bin/python ...) - Else: stop with an error ("No pyproject.toml or requirements.txt found.")
Project workflow (pyproject.toml)
Create venv + install dependencies
From the repo root (where pyproject.toml is):
-
uv sync
Notes:
- uv maintains a persistent project environment at
.venvand installs deps there.
Run scripts / commands (preferred)
Always run within the project environment:
-
uv run -- python <script.py> [args...] -
uv run -- python -m <module> [args...]
Notes:
-
uv runexecutes inside the project environment and ensures it is up-to-date.
Pip workflow (requirements.txt)
Create venv
From the repo root:
-
uv venv# creates.venvby default
Install dependencies
-
uv pip install -r requirements.txt
Run scripts / commands
Run using the venv interpreter directly (no activation required):
-
.venv/bin/python <script.py> [args...] -
.venv/bin/python -m <module> [args...]
(uv will also automatically find and use the default .venv in subsequent invocations when you use uv pip ... commands.)
Minimal sanity checks (optional)
-
test -x .venv/bin/python -
uv pip list(verify packages installed)
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-02-02
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!