# uv [![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv) [![image](https://img.shields.io/pypi/v/uv.svg)](https://pypi.python.org/pypi/uv) [![image](https://img.shields.io/pypi/l/uv.svg)](https://pypi.python.org/pypi/uv) [![image](https://img.shields.io/pypi/pyversions/uv.svg)](https://pypi.python.org/pypi/uv) [![Actions status](https://github.com/astral-sh/uv/actions/workflows/ci.yml/badge.svg)](https://github.com/astral-sh/uv/actions) [![Discord](https://img.shields.io/badge/Discord-%235865F2.svg?logo=discord&logoColor=white)](https://discord.gg/astral-sh) An extremely fast Python package and project manager, written in Rust.
Installing Trio's dependencies with a warm cache.
## Highlights - 🚀 A single tool to replace `pip`, `pip-tools`, `pipx`, `poetry`, `pyenv`, `twine`, `virtualenv`, and more. - ⚡️ [10-100x faster](https://github.com/astral-sh/uv/blob/main/BENCHMARKS.md) than `pip`. - 🐍 [Installs and manages](#python-management) Python versions. - 🛠️ [Runs and installs](#tool-management) Python applications. - ❇️ [Runs single-file scripts](#script-support), with support for [inline dependency metadata](https://docs.astral.sh/uv/guides/scripts#declaring-script-dependencies). - 🗂️ Provides [comprehensive project management](#project-management), with a [universal lockfile](https://docs.astral.sh/uv/concepts/projects#project-lockfile). - 🔩 Includes a [pip-compatible interface](#a-pip-compatible-interface) for a performance boost with a familiar CLI. - 🏢 Supports Cargo-style [workspaces](https://docs.astral.sh/uv/concepts/workspaces) for scalable projects. - 💾 Disk-space efficient, with a [global cache](https://docs.astral.sh/uv/concepts/cache) for dependency deduplication. - ⏬ Installable without Rust or Python via `curl` or `pip`. - 🖥️ Supports macOS, Linux, and Windows. uv is backed by [Astral](https://astral.sh), the creators of [Ruff](https://github.com/astral-sh/ruff). ## Installation Install uv with our standalone installers: ```bash # On macOS and Linux. curl -LsSf https://astral.sh/uv/install.sh | sh ``` ```bash # On Windows. powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" ``` Or, from [PyPI](https://pypi.org/project/uv/): ```bash # With pip. pip install uv ``` ```bash # Or pipx. pipx install uv ``` If installed via the standalone installer, uv can update itself to the latest version: ```bash uv self update ``` See the [installation documentation](https://docs.astral.sh/uv/getting-started/installation/) for details and alternative installation methods. ## Documentation uv's documentation is available at [docs.astral.sh/uv](https://docs.astral.sh/uv). Additionally, the command line reference documentation can be viewed with `uv help`. ## Features ### Project management uv manages project dependencies and environments, with support for lockfiles, workspaces, and more, similar to `rye` or `poetry`: ```console $ uv init example Initialized project `example` at `/home/user/example` $ cd example $ uv add ruff Creating virtual environment at: .venv Resolved 2 packages in 170ms Built example @ file:///home/user/example Prepared 2 packages in 627ms Installed 2 packages in 1ms + example==0.1.0 (from file:///home/user/example) + ruff==0.5.0 $ uv run ruff check All checks passed! ``` See the [project documentation](https://docs.astral.sh/uv/guides/projects/) to get started. uv also supports building and publishing projects, even if they're not managed with uv. See the [publish guide](https://docs.astral.sh/uv/guides/publish/) to learn more. ### Tool management uv executes and installs command-line tools provided by Python packages, similar to `pipx`. Run a tool in an ephemeral environment using `uvx` (an alias for `uv tool run`): ```console $ uvx pycowsay 'hello world!' Resolved 1 package in 167ms Installed 1 package in 9ms + pycowsay==0.0.0.2 """ ------------ < hello world! > ------------ \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || ``` Install a tool with `uv tool install`: ```console $ uv tool install ruff Resolved 1 package in 6ms Installed 1 package in 2ms + ruff==0.5.0 Installed 1 executable: ruff $ ruff --version ruff 0.5.0 ``` See the [tools documentation](https://docs.astral.sh/uv/guides/tools/) to get started. ### Python management uv installs Python and allows quickly switching between versions. Install multiple Python versions: ```console $ uv python install 3.10 3.11 3.12 Searching for Python versions matching: Python 3.10 Searching for Python versions matching: Python 3.11 Searching for Python versions matching: Python 3.12 Installed 3 versions in 3.42s + cpython-3.10.14-macos-aarch64-none + cpython-3.11.9-macos-aarch64-none + cpython-3.12.4-macos-aarch64-none ``` Download Python versions as needed: ```console $ uv venv --python 3.12.0 Using Python 3.12.0 Creating virtual environment at: .venv Activate with: source .venv/bin/activate $ uv run --python pypy@3.8 -- python --version Python 3.8.16 (a9dbdca6fc3286b0addd2240f11d97d8e8de187a, Dec 29 2022, 11:45:30) [PyPy 7.3.11 with GCC Apple LLVM 13.1.6 (clang-1316.0.21.2.5)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>>> ``` Use a specific Python version in the current directory: ```console $ uv python pin 3.11 Pinned `.python-version` to `3.11` ``` See the [Python installation documentation](https://docs.astral.sh/uv/guides/install-python/) to get started. ### Script support uv manages dependencies and environments for single-file scripts. Create a new script and add inline metadata declaring its dependencies: ```console $ echo 'import requests; print(requests.get("https://astral.sh"))' > example.py $ uv add --script example.py requests Updated `example.py` ``` Then, run the script in an isolated virtual environment: ```console $ uv run example.py Reading inline script metadata from: example.py Installed 5 packages in 12ms