重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
npx skills add https://github.com/laurigates/claude-plugins --skill uv-run使用 uv 运行 Python 脚本 - 无需手动激活虚拟环境。
uv run script.py 自动处理环境uv run --with requests script.py 满足一次性需求uvx tool 无需安装即可运行 CLI 工具# 运行脚本(uv 自动管理环境)
uv run script.py
# 带参数运行
uv run script.py --input data.csv --output results.json
# 运行特定模块
uv run -m http.server 8000
# 使用特定 Python 版本运行
uv run --python 3.12 script.py
为单次运行添加依赖,无需修改项目:
# 单个依赖
uv run --with requests fetch_data.py
# 多个依赖
uv run --with requests --with rich api_client.py
# 版本约束
uv run --with 'requests>=2.31' --with 'rich>12,<14' script.py
# 与项目依赖结合
uv run --with pytest-benchmark pytest # 为现有 pytest 添加基准测试
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
创建包含嵌入式依赖的自包含脚本:
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "requests>=2.31",
# "rich>=13.0",
# ]
# ///
import requests
from rich import print
response = requests.get("https://api.github.com")
print(response.json())
直接运行:
uv run script.py
# 或设为可执行:
chmod +x script.py
./script.py
# 使用元数据初始化脚本
uv init --script example.py --python 3.12
# 为脚本添加依赖
uv add --script example.py requests rich
# 锁定脚本依赖以确保可复现性
uv lock --script example.py
无需安装即可运行 CLI 工具:
# 运行工具一次
uvx pycowsay "Hello from uv!"
uvx httpie https://api.github.com
uvx ruff check .
# 使用特定版本
uvx ruff@0.1.0 check .
# uvx 是以下命令的简写:
uv tool run pycowsay "Hello"
#!/usr/bin/env -S uv run --script
# /// script
# dependencies = ["click", "rich"]
# ///
import click
from rich import print
@click.command()
@click.argument('name')
def hello(name):
print(f"[green]Hello, {name}![/green]")
if __name__ == "__main__":
hello()
#!/usr/bin/env -S uv run --script --python 3.12
# /// script
# requires-python = ">=3.12"
# dependencies = ["httpx"]
# ///
import httpx
# 使用 Python 3.12+ 的特性
| 场景 | 方法 |
|---|---|
| 快速一次性任务 | uv run --with pkg script.py |
| 可复用脚本 | 内联依赖 (PEP 723) |
| 可共享工具 | PEP 723 + shebang |
| 团队协作 | 内联依赖 + uv lock --script |
| 运行 CLI 工具一次 | uvx tool |
| 项目脚本 | uv run (使用项目依赖) |
uvx tool : 无需安装即可运行 CLI 工具 (例如 uvx ruff check .)
uv run --with pkg : 使用临时依赖运行 脚本 (例如 uv run --with requests script.py)
uvx httpie https://api.github.com
uv run --with httpx api_test.py
# CPU 性能分析
uv run python -m cProfile -s cumtime script.py | head -20
# 逐行性能分析(临时依赖)
uv run --with line-profiler kernprof -l -v script.py
# 内存性能分析
uv run --with memory-profiler python -m memory_profiler script.py
# 实时性能分析(临时工具)
uvx py-spy top -- python script.py
# 快速性能分析
uv run --with scalene python -m scalene script.py
每周安装量
69
代码仓库
GitHub 星标数
23
首次出现
2026年1月29日
安全审计
安装于
opencode64
github-copilot64
codex64
kimi-cli62
amp62
gemini-cli62
Run Python scripts with uv - no manual venv activation needed.
uv run script.py handles environment automaticallyuv run --with requests script.py for one-off needsuvx tool runs CLI tools without installation# Run script (uv manages environment automatically)
uv run script.py
# Run with arguments
uv run script.py --input data.csv --output results.json
# Run a specific module
uv run -m http.server 8000
# Run with specific Python version
uv run --python 3.12 script.py
Add dependencies for a single run without modifying project:
# Single dependency
uv run --with requests fetch_data.py
# Multiple dependencies
uv run --with requests --with rich api_client.py
# Version constraints
uv run --with 'requests>=2.31' --with 'rich>12,<14' script.py
# Combine with project dependencies
uv run --with pytest-benchmark pytest # Add benchmark to existing pytest
Create self-contained scripts with embedded dependencies:
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "requests>=2.31",
# "rich>=13.0",
# ]
# ///
import requests
from rich import print
response = requests.get("https://api.github.com")
print(response.json())
Run directly:
uv run script.py
# Or make executable:
chmod +x script.py
./script.py
# Initialize script with metadata
uv init --script example.py --python 3.12
# Add dependency to script
uv add --script example.py requests rich
# Lock script dependencies for reproducibility
uv lock --script example.py
Run CLI tools without installation:
# Run tool once
uvx pycowsay "Hello from uv!"
uvx httpie https://api.github.com
uvx ruff check .
# With specific version
uvx ruff@0.1.0 check .
# uvx is shorthand for:
uv tool run pycowsay "Hello"
#!/usr/bin/env -S uv run --script
# /// script
# dependencies = ["click", "rich"]
# ///
import click
from rich import print
@click.command()
@click.argument('name')
def hello(name):
print(f"[green]Hello, {name}![/green]")
if __name__ == "__main__":
hello()
#!/usr/bin/env -S uv run --script --python 3.12
# /// script
# requires-python = ">=3.12"
# dependencies = ["httpx"]
# ///
import httpx
# Uses Python 3.12+ features
| Scenario | Approach |
|---|---|
| Quick one-off task | uv run --with pkg script.py |
| Reusable script | Inline deps (PEP 723) |
| Shareable utility | PEP 723 + shebang |
| Team collaboration | Inline deps + uv lock --script |
| Run CLI tool once | uvx tool |
| Project scripts | uv run (uses project deps) |
uvx tool : Run a CLI tool without installation (e.g., uvx ruff check .)
uv run --with pkg : Run a script with temporary dependencies (e.g., uv run --with requests script.py)
uvx httpie https://api.github.com
uv run --with httpx api_test.py
# CPU profiling
uv run python -m cProfile -s cumtime script.py | head -20
# Line-by-line profiling (temporary dependency)
uv run --with line-profiler kernprof -l -v script.py
# Memory profiling
uv run --with memory-profiler python -m memory_profiler script.py
# Real-time profiling (ephemeral tool)
uvx py-spy top -- python script.py
# Quick profiling
uv run --with scalene python -m scalene script.py
Weekly Installs
69
Repository
GitHub Stars
23
First Seen
Jan 29, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode64
github-copilot64
codex64
kimi-cli62
amp62
gemini-cli62
Lark Drive API 使用指南:飞书云文档、Wiki、表格 Token 处理与文件管理
40,700 周安装
Nuxt Studio 设置与部署指南:为Nuxt Content网站添加可视化CMS编辑器
13 周安装
自主开发代理交付工单技能:AI自动化代码任务处理与PR交付
8 周安装
JSON 转 React Email 渲染器:用 JSON 规范生成 HTML/纯文本邮件 | @json-render/react-email
8 周安装
runtime-context技能:AI智能体运行时环境检测与工具适配,实现跨平台兼容性
9 周安装
JSON 转 SVG/PNG 图像渲染器 - 使用 Satori 将 JSON 规范快速生成图片
9 周安装
学术论文写作智能体工具:12个AI智能体流水线,支持LaTeX/PDF输出,涵盖所有学科
63 周安装