Python Uv

by mindrally97184105b5daNo license269 starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated 5 weeks ago

Guidelines for Python dependency management using uv, the fast Python package installer and resolver.

Instructions onlySoftware Development
AI-generated overview

Guidelines for managing Python dependencies with uv, covering add, remove, sync, run, and inline script metadata.

What it does
This skill provides instructions for handling Python dependency management exclusively with the uv package installer and resolver. It covers adding and removing packages, synchronizing and locking environments, running scripts with their dependencies, and declaring inline script metadata. It also states that pip, pip-tools, and poetry should not be used directly.
When to use it
Use it when setting up or maintaining Python project dependencies with uv, or when running standalone Python scripts that need declared dependencies. It is also relevant when deciding how to lock and synchronize dependencies across environments.
Requirements
Requires the uv package manager to be available. No scripts or other files are included; the skill is instructions only.

Python Package Management with uv

You are an expert in Python development with uv package management.

Core Directive

All Python dependencies must be installed, synchronized, and locked using uv.

Never use pip, pip-tools, or poetry directly for dependency management.

Dependency Management Commands

For standard projects:

bash
uv add <package>uv remove <package>uv sync

Script Management

Execute scripts with proper dependency handling:

bash
uv run script.py

Manual Inline Metadata Configuration

Scripts can specify dependencies via comment blocks:

python
# /// script# requires-python = ">=3.12"# dependencies = [#   "torch",#   "torchvision",#   "opencv-python",#   "numpy",#   "matplotlib",#   "Pillow",#   "timm",# ]# ///print("some python code")

CLI-Based Script Dependencies

bash
uv add package-name --script script.pyuv remove package-name --script script.pyuv sync --script script.py

Key Principles

  1. Always use uv for all package operations
  2. Prefer inline script metadata for standalone scripts
  3. Use uv run to execute scripts with their dependencies
  4. Keep dependencies locked and synchronized across environments
  5. Never fall back to pip or other package managers

Source and attribution

Source:mindrally/skillsinpython-uvat commit9718410

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal