Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

uv

БесплатноЗапускает вложенные скриптыНе проверен

Expert guidance for Astral's uv - an extremely fast Python package and project manager. Use when working with Python projects, managing dependencies, creating…

BbgnsurfTechот BbgnsurfTech★ 30 звёзд на GitHub8 установок в других каталогах

Об этом скилле

uv: Modern Python Package and Project Manager

Overview

uv is Astral's extremely fast Python package and project manager written in Rust, designed as a unified replacement for pip, pip-tools, pipx, poetry, pyenv, and virtualenv. It delivers 10-100x faster performance while providing modern dependency management with lockfiles and reproducible environments.

When to Use This Skill

Use this skill when:

  • Initializing new Python projects or scripts
  • Managing project dependencies with pyproject.toml
  • Creating portable single-file scripts with PEP 723 inline metadata
  • Installing or running command-line tools (ruff, black, httpie, etc.)
  • Managing Python interpreter versions
  • Setting up virtual environments
  • Configuring package indexes or private registries
  • Migrating from pip, pip-tools, poetry, or conda
  • Configuring CI/CD pipelines for Python projects
  • Setting up Docker containers for Python applications
  • Troubleshooting dependency resolution or build failures

Core Capabilities

1. Project Initialization and Management

Initialize new projects:

# Standard project with recommended structure
uv init myproject

# Application project (default)
uv init myapp --app

# Library/package project (includes src/ layout)
uv init mylib --lib --build-backend hatchling

# Bare project (pyproject.toml only)
uv init --bare

Project structure created:

myproject/
├── .venv/           # Virtual environment (auto-created)
├── .python-version  # Pinned Python version
├── README.md
├── main.py          # Sample entry point
├── pyproject.toml   # Project metadata and dependencies
└── uv.lock          # Lockfile (like Cargo.lock or package-lock.json)

2. Dependency Management

Add dependencies to project:

# Production dependencies
uv add requests 'flask>=2.0,<3.0' pydantic

# Development dependencies
uv add --dev pytest pytest-cov ruff mypy black

# Optional dependency groups
uv add --group docs sphinx sphinx-rtd-theme
uv add --group test pytest-asyncio hypothesis

# From various sources
uv add git+https://github.com/psf/requests@main
uv add --editable ./local-package
uv add ../sibling-package

Remove dependencies:

uv remove requests flask
uv remove --dev pytest
uv remove --group docs sphinx

Lock and sync environments:

# Update lockfile with latest compatible versions
uv lock

# Upgrade all packages
uv lock --upgrade

# Upgrade specific packages
uv lock --upgrade-package requests --upgrade-package flask

# Install all dependencies from lockfile
uv sync

# Install without dev dependencies (production)
uv sync --no-dev

# Install with optional groups
uv sync --extra docs --extra test

# Sync without updating lockfile (CI mode)
uv sync --frozen

# Error if lockfile out of sync (strict CI mode)
uv sync --locked

3. Running Code in Project Context

Execute scripts and commands:

# Run Python script in project environment
uv run python script.py

# Run module (like python -m)
uv run -m pytest
uv run -m flask run --port 8000

# Run with specific Python version
uv run --python 3.11 script.py
uv run --python [email protected] test.py

# Run without syncing first (use current environment state)
uv run --frozen script.py

# Run with additional temporary dependencies
uv run --with httpx --with rich script.py

# Run without project dependencies (standalone)
uv run --no-project example.py

# Run with environment variables from file
uv run --env-file .env script.py

4. PEP 723 Inline Script Metadata

Create portable single-file scripts with dependencies:

# Initialize script with metadata block
uv init --script example.py --python 3.12

# Add dependencies to existing script
uv add --script example.py requests rich

Example script structure:

#!/usr/bin/env -S uv --quiet run --active --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/repos/astral-sh/uv")
print(f"Stars: {response.json()['stargazers_count']}")

Run scripts:

# Auto-creates isolated environment and runs
uv run example.py

# Run with additional dependencies
uv run --with beautifulsoup4 example.py

# Lock script for reproducibility
uv lock --script example.py  # Creates example.py.lock

# Make executable and run directly
chmod +x example.py
./example.py

Best practices for scripts:

  • Always include requires-python for compatibility
  • Use version constraints for critical dependencies
  • Lock scripts before sharing for reproducibility
  • Add exclude-newer in [tool.uv] for time-based pinning

5. Tool Management

One-off tool execution (ephemeral environments):

# Run tool without installing (uvx is alias)
uvx ruff check
uvx pycowsay "hello from uv"

# Run specific version
uvx [email protected] check
uvx --from 'ruff>=0.3.0,<0.4.0' ruff check
Полный SKILL.md на GitHub

Установить uv в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

assets/docker_examples/Dockerfile.multi-stageassets/docker_examples/Dockerfile.simpleassets/github_actions/ci.ymlassets/pyproject_templates/advanced.tomlassets/pyproject_templates/basic.tomlassets/pyproject_templates/gitlab.tomlassets/script_examples/data_analysis.pyreferences/cli_reference.mdreferences/configuration.mdreferences/troubleshooting.md

FAQ

Что делает скилл uv?

Expert guidance for Astral's uv - an extremely fast Python package and project manager. Use when working with Python projects, managing dependencies, creating scripts with PEP 723 metadata, installing tools, managing Python versions, or configuring package indexes. Covers project initialization, dependency management, virtual environments, tool installation, workspace configuration, CI/CD integration, and migration from pip/poetry.

Как установить скилл uv?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл uv запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить uv с