uv-python
Skill0 starsChanged 8 months agoMITView on GitHub
How to use uv for Python package management, virtual environments, running scripts, and managing project dependencies. Use this skill whenever working with Python in any capacity — installing packages, running .py files, creating virtual environments, managing project dependencies, or troubleshooting import errors and module-not-found issues. Trigger on ANY of: `pip install`, `python -m`, `python3`, `.py` files, `pyproject.toml`, `requirements.txt`, virtualenv/venv, ModuleNotFoundError, ImportError, or any mention of Python package management. If uv is available on the system, ALWAYS prefer it over pip, pip-tools, virtualenv, pyenv, or poetry. Even if the user doesn't mention uv, use it when doing Python work.
- Pipes a download into a shell
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Enjoyoer/loadouttheir own version, first seen Oct 18, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- Enjoyoer/loadout★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
Before using uv, verify it's installed:
- Distinctive: line 30
If uv is not installed, you can install it with:
- Very specific: line 166
When you request a Python version (via .python-version, requires-python in pyproject.toml, or --python flag), uv will automatically …
- Very specific: line 194
If there's a pyproject.toml in the current or parent directory, uv run will try to install the project first.
- Very specific: line 227
If a project has existing requirements.txt files:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
uv — Python Package & Project Manager
uv is an extremely fast Python package and project manager written in Rust. It replaces pip, pip-tools, pipx, poetry, pyenv, virtualenv, and more with a single tool. If uv is available, always prefer it over pip and other Python tooling.
How uv handles Python (the short version)
uv manages its own Python installations from prebuilt standalone distributions (from Astral's python-build-standalone project). It will automatically download and install the right Python version when needed — you don't need to worry about pyenv, system Python, which python3, or any of that. When you run uv run or uv sync, uv ensures the correct Python is available, the virtual environment exists, and dependencies are installed. Trust the tool.
Check if uv is available
Before using uv, verify it's installed:
which uv && uv --versionIf uv is not installed, you can install it with:
curl -LsSf https://astral.sh/uv/install.sh | shThen ensure it's on PATH: source $HOME/.local/bin/env (or restart the shell).
Decision Tree: Which uv workflow do I need?
Pick the right approach based on context:
1. Quick one-off script (no project structure)
You have a single .py file and just need to run it, possibly with some dependencies.
Run with ad-hoc dependencies:
uv run --with requests --with pandas my_script.pyBetter: use inline script metadata (PEP 723) so dependencies are self-documenting:
# /// script
# dependencies = [
# "requests",
# "pandas>=2.0",
# ]
# ///
import requests
import pandas as pd
# ...Then just:
uv run my_script.pyuv creates an isolated temporary environment, installs dependencies, runs the script. No venv activation, no pip install, no cleanup.
Add dependencies to an existing script:
uv add --script my_script.py requests pandas2. Project with pyproject.toml
You're in a directory with (or creating) a structured Python project.
Initialize a new project:
uv init my-project
cd my-projectThis creates pyproject.toml, .python-version, main.py, and a .gitignore.
Add dependencies:
uv add requests pandas numpy
uv add --dev pytest ruff # dev-only dependenciesThis updates pyproject.toml, resolves versions, updates uv.lock, and installs into .venv.
Remove dependencies:
uv remove pandasRun commands in the project environment:
uv run python main.py
uv run pytest
uv run python -c "import requests; print(requests.__version__)"uv run automatically ensures the environment is synced before execution. You do NOT need to activate the venv.
Sync the environment (install everything from the lockfile):
uv syncUpdate the lockfile (after manual edits to pyproject.toml):
uv lock3. Low-level pip-style commands (legacy / escape hatch)
Sometimes you need direct control — e.g., installing into a specific venv without a pyproject.toml, or working with an existing requirements.txt. uv provides a pip-compatible interface for this.
Create a virtual environment:
uv venv # creates .venv with default Python
uv venv --python 3.11 # creates .venv with Python 3.11
uv venv my-env # creates my-env/ instead of .venv/Install packages:
uv pip install requests pandas
uv pip install -r requirements.txt
uv pip install -e . # editable install of current projectList / inspect:
uv pip list
uv pip show requests
uv pip freezeImportant:
uv pip installinstalls into the active venv (or.venvif found). It will NOT install into the system Python by default. If you need system-level installs (e.g., in a container), pass--system.
4. Running CLI tools (replacing pipx)
Need to run a tool like ruff, black, pytest, or jupyterlab without polluting your project?
uvx ruff check . # run in ephemeral environment
uvx black my_file.py
uv tool install ruff # install persistently, adds to PATHManaging Python Versions
uv python install 3.12 # install a specific version
uv python install 3.10 3.11 # install multiple
uv python list # see what's available/installed
uv python pin 3.11 # pin current directory to 3.11When you request a Python version (via .python-version, requires-python in pyproject.toml, or --python flag), uv will automatically download it if not already present.
Common Pitfalls & Anti-Patterns
❌ Don't: pip install <package>
Do: uv pip install <package> or better, uv add <package> (in a project).
Raw pip install bypasses uv's resolver, may install into the wrong environment, and won't update your lockfile.
❌ Don't: python -m venv .venv && source .venv/bin/activate && pip install ...
Do: uv venv && uv pip install ... or just use uv init + uv add for projects.
uv handles venv creation, Python version selection, and package installation in one coherent flow.
❌ Don't: activate the venv to run things
Do: uv run <command>
uv run handles environment syncing and activation transparently. You rarely need source .venv/bin/activate.
❌ Don't: pip install --break-system-packages
Do: uv pip install --system if you truly need system-level installs (containers, CI).
❌ Don't: worry about which Python is on PATH
Do: Let uv manage it. Use --python 3.11 or .python-version files to request versions. uv resolves the right interpreter automatically.
⚠️ Watch out: uv run in a project directory
If there's a pyproject.toml in the current or parent directory, uv run will try to install the project first. For standalone scripts that don't belong to the project, use:
uv run --no-project script.pyQuick Reference
| Task | Command |
| Run a script with deps | uv run --with pkg script.py |
| Run a script (inline deps) | uv run script.py |
| Init new project | uv init project-name |
| Add dependency | uv add package-name |
| Add dev dependency | uv add --dev package-name |
| Remove dependency | uv remove package-name |
| Run in project env | uv run python main.py |
| Sync environment | uv sync |
| Lock dependencies | uv lock |
| Create venv | uv venv |
| pip install (low-level) | uv pip install package |
| Install from requirements | uv pip install -r requirements.txt |
| Run a CLI tool | uvx tool-name |
| Install a CLI tool | uv tool install tool-name |
| Install Python version | uv python install 3.12 |
| Pin Python version | uv python pin 3.11 |
| View dep tree | uv tree |
Working with requirements.txt (Migration Path)
If a project has existing requirements.txt files:
# Create a project from existing requirements
uv init
uv add -r requirements.txt
# Or for low-level usage without a project
uv venv
uv pip install -r requirements.txtTo generate a locked requirements.txt from a project (e.g., for Docker):
uv export --format requirements-txt > requirements.txtDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

