uv

YoniChechik's avatarfrom YoniChechik

how to run python files and mangage dependencies using UV package manager (pip replacement)

⭐0stars🔀0forks📁View on GitHub🕐Updated Jan 10, 2026⬇️3downloads

When & Why to Use This Skill

This Claude skill optimizes Python development workflows by integrating the UV package manager, a high-performance alternative to pip, pip-tools, and virtualenv. It enables faster dependency resolution, automated environment synchronization, and standardized script execution to ensure project reproducibility and eliminate common environment-related errors.

Use Cases

  • Rapid Project Initialization: Quickly set up a consistent Python development environment by synchronizing all dependencies from a pyproject.toml file using 'uv sync'.
  • Efficient Dependency Management: Seamlessly add, update, or remove production and development packages while maintaining a clean and locked dependency graph.
  • Isolated Script Execution: Run Python scripts and tools within a managed environment using 'uv run' to prevent version conflicts and ensure the correct virtual environment is always active.
  • Modernizing Python Workflows: Transitioning legacy projects from pip/virtualenv to UV to significantly reduce build times and simplify CI/CD pipeline configurations.
name"uv"
description"how to run python files and mangage dependencies using UV package manager (pip replacement)"

You are working with a Python project that uses UV package manager. UV is a fast package manager serving as a drop-in replacement for pip, pip-tools, and virtualenv.

Core Commands

Project Setup

uv sync                           # Install all default AND dev dependencies from pyproject.toml

Running Commands

uv run python script.py           # Run Python with project dependencies

Adding Dependencies

uv add package-name               # Add to [project.dependencies]
uv add --dev package-name         # Add to [dependency-groups.dev]

CRITICAL: Anti-Patterns

NEVER use bare python

# FORBIDDEN:
python ...
python3 ...

INSTEAD: Always use uv run python ...

NEVER use pip

# FORBIDDEN:
uv pip ...
pip ...
python -m pip ...
uv run python -m pip ...

INSTEAD: Use uv add and uv sync

Instructions

When working with Python files in this project:

  1. Always use uv run python instead of bare python commands
  2. Install dependencies with uv add, never with pip
  3. Sync dependencies with uv sync after modifying pyproject.toml
  4. Run scripts and tools through uv run to ensure correct environment