uv — Fast Python Package Manager

VerifiedCaution

Install Python packages, create virtual environments, lock dependencies and manage Python versions with a single fast CLI tool replacing pip, poetry and pyenv.

Sby Skills Guide Bot
DevelopmentIntermediate
11/17/2026
Claude CodeCursorWindsurfCopilotCodex
#python#package-manager#dependency-management#lockfile#virtual-environments

Recommended for

Automated summary

Presents uv as a single tool for initializing Python projects, managing dependencies and environments, locking versions, and running scripts or tools.

Strengths

  • Combines project setup, dependency management, lockfiles, environments, and Python versions in one command-line interface.
  • Provides explicit CI and production commands such as uv sync --locked, --frozen, and --no-dev.
  • Covers scripts with inline dependencies and tool execution through uvx, without manual environment activation.
  • Includes concrete examples for dependency groups, extras, and targeted package upgrades.

Limitations

  • Migration from Poetry or pip-tools is not covered beyond importing a requirements.txt file.
  • The supplied document stops midway through the inline-scripts section, leaving that use case only partially documented.
  • Using uv requires the project to accept uv.lock and the Astral ecosystem.
When to use it

Use it to start or manage a Python project with locked dependencies and fast installs locally, in CI, or in Docker.

When not to use it

Avoid it when the project is tightly committed to an existing Poetry or pip-tools workflow and cannot adopt uv.lock.

Security analysis

Caution
Quality score86/100

The content is genuine uv documentation with no malicious or obfuscated instructions. Risk is limited to the inherent behavior of a package manager: running bash, network installs, and execution of downloaded packages/scripts, which is legitimate but warrants a caution rating. A secondary concern is the potentially fabricated version numbers and pinned action SHAs in the CI example.

Findings
  • •The skill is a reference document whose commands install and execute third-party code over the network (pipx/brew install, `uv run`, `uvx`, inline-script dependency resolution, `uv pip install`). This is legitimate for a package manager but means an agent following it will download and run arbitrary packages/scripts, so the trust boundary is the package index.
  • •The CI example pins GitHub Actions by commit SHA (`actions/checkout@3d3c42...`, `astral-sh/setup-uv@68559e...`) and specific versions (v7.0.1, v10.3.3, uv 0.13.7). These appear inflated or unverifiable; if a pinned SHA is wrong or fabricated, it is a supply-chain concern rather than a harmless typo.
  • •Example 1 pipes a filtered requirements file into `uv add --dev -r -` (sed pipeline); harmless here but a pattern that could inject unintended lines if reused on untrusted input.
  • •No prompt-injection, obfuscation, exfiltration, or destructive commands (no curl|sh, rm -rf, base64 payloads, or secret egress). The credential guidance correctly recommends env vars and warns against committing secrets.
  • •The skill drives network installs and execution of third-party code (pip/PyPI indexes, git sources, `uvx`/`uv tool run`, inline-dependency scripts, `uv sync`/`uv run`, Docker `COPY --from=ghcr.io/astral-sh/uv`); this is normal package-manager use but means the agent will fetch and execute untrusted packages if asked.
  • •`uv sync` and `uv pip sync` remove packages not present in the lock/requirements file, and `uv pip` target selection is by discovery (active VIRTUAL_ENV or nearest `.venv`), so a wrong working directory can mutate an unintended environment — the skill does warn about this.
  • •No `allowed-tools` are declared, so nothing constrains the agent from running the shell/Docker commands shown; no instruction restricts the agent from piping remote installers, though the skill deliberately points to the docs page instead of inlining a `curl | sh`.
  • •Supply-chain guidance is present and positive (pin versions, `--locked` in CI, avoid `unsafe-best-match`, keep index credentials in env vars, review inline dependencies of untrusted scripts); no exfiltration, obfuscation, credential harvesting, or safety-disabling content, and no embedded secrets.
How this analysis is made

Examples

Create a locked Python project
Initialize a new Python API project with uv, add FastAPI and pytest as dev dependencies, and make sure uv.lock is up to date.
Migrate requirements.txt
Migrate this requirements.txt file into a uv project with grouped dependencies and a lockfile.
Run a script with inline dependencies
Create and run a standalone Python script with inline dependencies using uv, without setting up a full project.

name: uv description: >- Installs Python packages, creates virtual environments, locks dependencies and manages Python versions with one fast command-line tool that replaces pip, pip-tools, pipx, poetry, pyenv and virtualenv. Use when a user asks to set up a Python project, add or upgrade a dependency, create a lockfile, migrate from requirements.txt, run a script with inline dependencies, install a Python version, run a tool with uvx, or speed up installs in CI and Docker. license: Apache-2.0 compatibility: "macOS 13+, Linux (glibc 2.17+ or musl 1.1+) or Windows 10+; no existing Python or Rust installation required" metadata: author: terminal-skills version: "1.1.0" category: development tags: "python, package-manager, lockfile, virtual-environments, dependency-management" repository: https://github.com/astral-sh/uv

uv — Fast Python package and project manager

Overview

uv is a single binary from Astral that covers the whole Python workflow: projects with a cross-platform lockfile (uv.lock), single-file scripts with inline dependencies, command-line tools (uvx), Python interpreter installs, and a drop-in uv pip interface. It downloads Python itself when needed, so a machine needs nothing but uv.

Instructions

Installation

# Package managers
pipx install uv
brew install uv
winget install --id=astral-sh.uv -e

Astral also publishes a standalone installer for machines without a package manager; the installation page at https://docs.astral.sh/uv/getting-started/installation/ has the current command and checksums.

uv --version
uv self update     # standalone installer only; otherwise upgrade with the package manager

To pin a release, put the version in the installer URL: https://astral.sh/uv/0.13.7/install.sh.

Create a project

uv init dispatch-api               # packaged app: src/dispatch_api/, uv_build backend, console script
uv init --no-package cron-jobs     # flat layout with main.py and no build system
uv init --lib geo-utils            # library with a py.typed marker
uv init --bare --python 3.12       # only pyproject.toml, in the current directory

uv init also writes .python-version, README.md, .gitignore and initialises git. --bare writes nothing but pyproject.toml, which makes it the right choice inside an existing repository.

Manage dependencies

uv add 'httpx>=0.27' 'pydantic>=2.7,<3'     # runtime dependencies
uv add --dev pytest ruff                    # dev group, not shipped to production
uv add --group docs mkdocs                  # any named dependency group
uv add --optional postgres 'psycopg[binary]'   # extra: pip install dispatch-api[postgres]
uv add -r requirements.txt                  # import an existing requirements file
uv remove httpx

uv lock --upgrade-package pydantic          # bump one package within its constraints
uv lock --upgrade                           # bump everything
uv tree --outdated --depth 1                # what has a newer release

The first uv add creates .venv/ and uv.lock. Every change updates pyproject.toml, the lockfile and the environment together.

Run and sync

uv run pytest                        # locks and syncs if needed, then runs inside .venv
uv run python -m dispatch_api
uv run --with rich python -c "import rich"   # one extra package for this command only

uv sync                              # install everything, dev group included
uv sync --locked                     # CI: fail if uv.lock does not match pyproject.toml
uv sync --frozen --no-dev            # production: use uv.lock as-is, skip the dev group
uv sync --extra postgres
uv lock --check                      # exit non-zero when the lockfile is stale

No activation is needed; uv run finds the project environment by itself.

Scripts with inline dependencies

uv init --script fetch-rates.py --python 3.12
uv add --script fetch-rates.py 'httpx<1' rich
uv run fetch-rates.py
uv lock --script fetch-rates.py      # writes fetch-rates.py.lock for reproducible runs

uv add --script maintains a metadata block at the top of the file:

# /// script
# requires-python = ">=3.12"
# dependencies = [
#     "httpx<1",
#     "rich>=15.0.0",
# ]
# ///

Add #!/usr/bin/env -S uv run --script as the first line and chmod +x the file to run it directly.

Tools

uvx ruff check .                         # run without installing; uvx = uv tool run
uvx ruff@0.16.9 check .                  # exact version
uvx --from 'markitdown[pdf]' markitdown q3-board-report.pdf   # command name differs from the spec
uv tool install ruff                     # permanent, isolated install on PATH
uv tool upgrade --all
uv tool list
uv tool uninstall ruff

Installed tools land in the directory printed by uv tool dir --bin; uv warns when that directory is not on PATH.

Python versions

uv python install 3.12 3.13
uv python list --only-installed
uv python pin 3.12              # writes .python-version
uv run --python 3.13 pytest     # one-off run on another interpreter
uv python upgrade 3.12          # latest patch release of 3.12
uv venv --python 3.12           # plain virtual environment at .venv

Requests accept 3.12, 3.12.3, >=3.11,<3.13, pypy@3.10 and 3.13t (free-threaded). uv downloads a missing interpreter automatically; pass --no-python-downloads to forbid that.

pip-compatible interface

uv venv
uv pip install -r requirements.txt
uv pip compile requirements.in -o requirements.txt --universal
uv pip sync requirements.txt        # removes anything not listed
uv pip install --python .venv/bin/python 'rich>=13'

CI and Docker

name: ci
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
        with:
          version: "0.13.7"
          enable-cache: true
      - run: uv python install
      - run: uv sync --locked --all-extras --dev
      - run: uv run pytest
FROM python:3.12-slim
COPY --from=ghcr.io/astral-sh/uv:0.13.7 /uv /uvx /bin/
WORKDIR /app
ENV UV_NO_DEV=1 UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy

# Dependencies first, so this layer is reused until uv.lock changes
RUN --mount=type=cache,target=/root/.cache/uv \
    --mount=type=bind,source=uv.lock,target=uv.lock \
    --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
    uv sync --locked --no-install-project

COPY . /app
RUN --mount=type=cache,target=/root/.cache/uv uv sync --locked
ENV PATH="/app/.venv/bin:$PATH"
CMD ["python", "-m", "dispatch_api"]

Add .venv to .dockerignore; a host environment does not work inside the image.

Examples

Example 1: Move a requirements.txt service to a locked uv project

Request: "Our dispatch-api repo has requirements.txt and requirements-dev.txt. Move it to uv with a lockfile and make the tests run."

cd dispatch-api
uv init --bare --python 3.12
uv python pin 3.12
uv add -r requirements.txt
sed '/^-r /d' requirements-dev.txt | uv add --dev -r -
uv run python -m pytest -q
uv run ruff check .

Result: pyproject.toml lists the five runtime packages and a dev group, uv.lock pins 30 packages, and the checks pass. Abridged output:

Initialized project `dispatch-api`
Pinned `.python-version` to `3.12`
 + uvicorn==0.34.0
 + pytest==8.3.4
 + ruff==0.8.6
1 passed, 1 warning in 0.12s
All checks passed!

Example 2: A self-contained script

Request: "Write a disk usage report script I can copy to any server and run without setting up an environment."

#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.12"
# dependencies = ["rich>=13"]
# ///
import shutil

from rich.console import Console
from rich.table import Table

usage = shutil.disk_usage("/")
table = Table(title="Disk usage")
table.add_column("Total GB")
table.add_column("Free GB")
table.add_row(f"{usage.total / 1e9:.0f}", f"{usage.free / 1e9:.0f}")
Console().print(table)
chmod +x disk-report.py
./disk-report.py

Result: uv builds a cached environment with rich on the first run and prints the table; later runs start immediately.

      Disk usage
┏━━━━━━━━━━┳━━━━━━━━━┓
┃ Total GB ┃ Free GB ┃
┡━━━━━━━━━━╇━━━━━━━━━┩
│ 3936     │ 2211    │
└──────────┴─────────┘

Guidelines

  • Commit uv.lock and .python-version. Never edit uv.lock by hand; change pyproject.toml or use uv add, uv remove and uv lock.
  • --locked or --frozen: --locked verifies the lockfile and fails when it is stale, which suits CI. --frozen skips the check and installs exactly what the file says.
  • uv sync is exact, uv run is not. uv sync removes packages that are not in the lockfile, including anything added with uv pip install. uv run only adds what is missing.
  • uv pip picks its target by discovery: the active VIRTUAL_ENV, then .venv in the current directory or the nearest parent. Run from the wrong folder and it installs into someone else's environment. In scripts pass --python with the environment path.
  • Flat projects and pytest: with --bare or --no-package the project itself is not installed, so uv run pytest can fail with ModuleNotFoundError. Use uv run python -m pytest, or set pythonpath = ["."] under [tool.pytest.ini_options].
  • Pin the Python version. Since uv 0.13 the default stable Python for uv python install and uv venv without a request is 3.15 (it was 3.14). Run uv python pin <version> so every machine and CI uses the same interpreter.
  • uv init defaults to a packaged src/ layout. Pass --no-package for a script-style project with main.py.
  • Experimental commands: uv format, uv check and uv audit print a warning that they may change. Do not build pipelines on them yet.
  • Private indexes: declare them under [[tool.uv.index]] and pass credentials through environment variables named after the index: for an index called internal, UV_INDEX_INTERNAL_USERNAME and UV_INDEX_INTERNAL_PASSWORD. Never commit them. The default first-index strategy protects against dependency confusion; avoid unsafe-best-match.
  • Supply chain: uv run, uvx and scripts with inline metadata download and execute packages. Review the dependency list of any script from an untrusted source before running it.
  • uv self update works only for installs made with the standalone installer.
  • CI cache: run uv cache prune --ci before saving the cache to keep it small.
  • When NOT to use it: uv installs from Python package indexes, git and local paths. It does not install conda packages or system libraries, so keep conda for stacks that depend on them.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/uv-fast-python-package-manager-mwk700aj/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/uv-fast-python-package-manager-mwk700aj' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/uv-fast-python-package-manager-mwk700aj/download' --output '.skill-downloads/uv-fast-python-package-manager-mwk700aj/SKILL.md.part' && mv '.skill-downloads/uv-fast-python-package-manager-mwk700aj/SKILL.md.part' '.skill-downloads/uv-fast-python-package-manager-mwk700aj/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Environment declared by the author: macOS 13+, Linux (glibc 2.17+ or musl 1.1+) or Windows 10+; no existing Python or Rust installation required

Original excerpt: Installation
# Package managers
pipx install uv
brew install uv
winget install --id=astral-sh.uv -e

Astral also publishes a standalone installer for machines without a package manager; the installation page at https://docs.astral.sh/uv/getting-started/installation/ has the current command and checksums.

uv --version
uv self update     # standalone installer only; otherwise upgrade with the package manager

To pin a release, put the version in the installer URL: https://astral.sh/uv/0.13.7/install.sh.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/uv-fast-python-package-manager-mwk700aj/SKILL.md' && test -s '.skill-downloads/uv-fast-python-package-manager-mwk700aj/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/uv' && cp -R '.skill-downloads/uv-fast-python-package-manager-mwk700aj' '.claude/skills/uv'

Cursor
test -f '.skill-downloads/uv-fast-python-package-manager-mwk700aj/SKILL.md' && test -s '.skill-downloads/uv-fast-python-package-manager-mwk700aj/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/uv' && cp -R '.skill-downloads/uv-fast-python-package-manager-mwk700aj' '.cursor/skills/uv'

Codex
test -f '.skill-downloads/uv-fast-python-package-manager-mwk700aj/SKILL.md' && test -s '.skill-downloads/uv-fast-python-package-manager-mwk700aj/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/uv' && cp -R '.skill-downloads/uv-fast-python-package-manager-mwk700aj' '.agents/skills/uv'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/uv-fast-python-package-manager-mwk700aj'

openskills read 'uv-fast-python-package-manager-mwk700aj'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/uv-fast-python-package-manager-mwk700aj/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills