Synthèse automatique
Présente uv comme un outil unique pour initialiser des projets Python, gérer les dépendances et environnements, verrouiller les versions et exécuter des scripts ou outils.
Points forts
- Regroupe initialisation, dépendances, lockfile, environnements et versions de Python dans une seule interface en ligne de commande.
- Propose des commandes explicites pour la CI et la production, comme uv sync --locked, --frozen et --no-dev.
- Couvre les scripts à dépendances inline et l'exécution d'outils via uvx, sans activation manuelle de l'environnement.
- Donne des exemples concrets pour les groupes de dépendances, les extras et la mise à jour ciblée d'un paquet.
Limites
- La migration depuis Poetry ou pip-tools n'est pas détaillée au-delà de l'import d'un requirements.txt.
- Le document fourni s'arrête au milieu de la section sur les scripts inline, ce qui laisse ce cas d'usage partiellement documenté.
- Adopter uv implique d'accepter uv.lock et l'écosystème Astral dans le projet.
À utiliser pour démarrer ou gérer un projet Python avec des dépendances verrouillées et des installations rapides en local, en CI ou dans Docker.
À éviter si le projet est fortement lié à un workflow Poetry ou pip-tools existant et ne peut pas adopter uv.lock.
Analyse de sécurité
PrudenceThe 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.
- •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.
Exemples
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 this requirements.txt file into a uv project with grouped dependencies and a lockfile.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.lockand.python-version. Never edituv.lockby hand; changepyproject.tomlor useuv add,uv removeanduv lock. --lockedor--frozen:--lockedverifies the lockfile and fails when it is stale, which suits CI.--frozenskips the check and installs exactly what the file says.uv syncis exact,uv runis not.uv syncremoves packages that are not in the lockfile, including anything added withuv pip install.uv runonly adds what is missing.uv pippicks its target by discovery: the activeVIRTUAL_ENV, then.venvin the current directory or the nearest parent. Run from the wrong folder and it installs into someone else's environment. In scripts pass--pythonwith the environment path.- Flat projects and pytest: with
--bareor--no-packagethe project itself is not installed, souv run pytestcan fail withModuleNotFoundError. Useuv run python -m pytest, or setpythonpath = ["."]under[tool.pytest.ini_options]. - Pin the Python version. Since uv 0.13 the default stable Python for
uv python installanduv venvwithout a request is 3.15 (it was 3.14). Runuv python pin <version>so every machine and CI uses the same interpreter. uv initdefaults to a packagedsrc/layout. Pass--no-packagefor a script-style project withmain.py.- Experimental commands:
uv format,uv checkanduv auditprint 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 calledinternal,UV_INDEX_INTERNAL_USERNAMEandUV_INDEX_INTERNAL_PASSWORD. Never commit them. The defaultfirst-indexstrategy protects against dependency confusion; avoidunsafe-best-match. - Supply chain:
uv run,uvxand scripts with inline metadata download and execute packages. Review the dependency list of any script from an untrusted source before running it. uv self updateworks only for installs made with the standalone installer.- CI cache: run
uv cache prune --cibefore 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.
Du fichier au premier essai
Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.
Consulter la source et ses fichiers annexesCe téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.
1. Télécharger le fichier
Télécharger SKILL.mdDepuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/uv-fast-python-package-manager-mwk700aj/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.
Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.
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. Vérifier les prérequis
Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.
Environnement déclaré par l’auteur : macOS 13+, Linux (glibc 2.17+ or musl 1.1+) or Windows 10+; no existing Python or Rust installation required
Extrait original : 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.
Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.
3. Charger la skill
Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.
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 doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.
Installation officielle d’OpenSkillsopenskills install './.skill-downloads/uv-fast-python-package-manager-mwk700aj'openskills read 'uv-fast-python-package-manager-mwk700aj'La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.
Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.
openskills syncMode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.
4. Faire un premier essai
Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :
Lis .skill-downloads/uv-fast-python-package-manager-mwk700aj/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.
Bonnes pratiques React Hook Form
Developpement
Maîtrisez React Hook Form : évitez les anti-patterns, gérez les abonnements, et traitez correctement reset, dirty state et entrées contrôlées.
Migration Emotion vers Mantine
Developpement
Migrer les styled-components Emotion vers des composants Mantine avec style props et modules CSS. Pour convertir .styled.tsx ou supprimer les imports @emotion.
Détecteur de dérive de périmètre
Developpement
Analyse les diffs git par rapport à une intention pour détecter la dérive de périmètre, fichiers non liés et PR trop larges, puis suggère de garder, diviser ou justifier.