### Install tools with various options Source: https://github.com/astral-sh/uv/blob/main/docs/guides/tools.md Examples demonstrating how to install tools with specific version constraints, from Git repositories, with LFS support, or with additional packages and executables. ```console $ uv tool install httpie ``` ```console $ uv tool install 'httpie>0.1.0' ``` ```console $ uv tool install git+https://github.com/httpie/cli ``` ```console $ uv tool install --lfs git+https://github.com/astral-sh/lfs-cowsay ``` ```console $ uv tool install mkdocs --with mkdocs-material ``` ```console $ uv tool install --with-executables-from ansible-core,ansible-lint ansible ``` -------------------------------- ### Install Ansible with executables from related packages using uv Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/tools.md Example of installing Ansible and making executables from `ansible-core` and `ansible-lint` available. ```console uv tool install --with-executables-from ansible-core,ansible-lint ansible ``` -------------------------------- ### Set up and run marimo in a non-project virtual environment Source: https://github.com/astral-sh/uv/blob/main/docs/guides/integration/marimo.md Initializes a virtual environment, installs `numpy` and `marimo`, then starts marimo for interactive editing. ```console uv venv uv pip install numpy uv pip install marimo uv run marimo edit ``` -------------------------------- ### Install and Verify a Python Tool with uv Source: https://github.com/astral-sh/uv/blob/main/README.md Install a command-line tool globally using `uv tool install` and then verify its installation and version. ```console $ uv tool install ruff Resolved 1 package in 6ms Installed 1 package in 2ms + ruff==0.5.0 Installed 1 executable: ruff ``` ```console $ ruff --version ruff 0.5.0 ``` -------------------------------- ### Example requirements.txt Leading to Old Package Build Source: https://github.com/astral-sh/uv/blob/main/docs/reference/troubleshooting/build-failures.md This requirements.txt demonstrates a dependency setup that can cause uv to attempt building an older, potentially problematic version of a package like apache-beam. ```text dill<0.3.9,>=0.2.2 apache-beam<=2.49.0 ``` -------------------------------- ### Install dependencies from a basic requirements.txt file Source: https://github.com/astral-sh/uv/blob/main/docs/guides/migration/pip-to-project.md Use this command to install all packages listed in a requirements.txt file into the current environment. ```console pip install -r requirements.txt ``` -------------------------------- ### Install uv with WinGet Source: https://github.com/astral-sh/uv/blob/main/docs/getting-started/installation.md Install uv using the WinGet package manager on Windows. ```console $ winget install --id=astral-sh.uv -e ``` -------------------------------- ### Install and use uv tools in Dockerfile Source: https://github.com/astral-sh/uv/blob/main/docs/guides/integration/docker.md Sets the PATH to include the `uv` tool bin directory and then installs a tool like `cowsay` using `uv tool install`. ```Dockerfile ENV PATH=/root/.local/bin:$PATH RUN uv tool install cowsay ``` -------------------------------- ### Install uv with pip Source: https://github.com/astral-sh/uv/blob/main/docs/getting-started/installation.md Install uv using pip, an alternative to pipx for PyPI installations. ```console $ pip install uv ``` -------------------------------- ### Install uv by copying binaries in Dockerfile Source: https://github.com/astral-sh/uv/blob/main/docs/guides/integration/docker.md Copy the uv binaries from the official distroless image into a Python base image for a minimal installation, avoiding the installer. ```dockerfile FROM python:3.12-slim-trixie COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ ``` -------------------------------- ### GitHub Actions Workflow: uv Project Sync and Run Source: https://github.com/astral-sh/uv/blob/main/docs/guides/integration/github.md Example workflow to install `uv`, sync project dependencies, and run commands like `pytest` within a GitHub Actions job. ```yaml name: Example jobs: uv-example: name: python runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Install uv uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 - name: Install the project run: uv sync --locked --all-extras --dev - name: Run tests # For example, using `pytest` run: uv run pytest tests ``` -------------------------------- ### Install uv with pipx Source: https://github.com/astral-sh/uv/blob/main/docs/getting-started/installation.md Install uv into an isolated environment using pipx, which is the recommended method when installing from PyPI. ```console $ pipx install uv ``` -------------------------------- ### Install uv with Scoop Source: https://github.com/astral-sh/uv/blob/main/docs/getting-started/installation.md Install uv using the Scoop package manager on Windows. ```console $ scoop install main/uv ``` -------------------------------- ### Installing multiple Python versions with uv Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/python-versions.md Install several Python versions simultaneously by listing them after uv python install. ```console $ uv python install 3.9 3.10 3.11 ``` -------------------------------- ### Installing a specific Python implementation with uv Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/python-versions.md Install a particular Python implementation, such as PyPy, using uv python install. ```console $ uv python install pypy ``` -------------------------------- ### Install a tool using uv tool install Source: https://github.com/astral-sh/uv/blob/main/docs/guides/tools.md Installs a specified tool, like Ruff, to a persistent environment, making its executables available in the system's PATH. ```console $ uv tool install ruff ``` -------------------------------- ### Verify uv Installation Source: https://github.com/astral-sh/uv/blob/main/docs/getting-started/first-steps.md Run the `uv` command in your console to confirm successful installation and view the help menu. ```console $ uv An extremely fast Python package manager. Usage: uv [OPTIONS] ... ``` -------------------------------- ### Install uv with PowerShell on Windows Source: https://github.com/astral-sh/uv/blob/main/docs/getting-started/installation.md Use PowerShell's irm to download and execute the uv installation script on Windows. ```pwsh-session PS> powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" ``` -------------------------------- ### Install Multiple Python Versions with uv Source: https://github.com/astral-sh/uv/blob/main/docs/index.md Use the `uv python install` command to download and install specified Python versions for use with uv. ```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 ``` -------------------------------- ### Install Multiple Python Versions with uv Source: https://github.com/astral-sh/uv/blob/main/README.md Install several specific Python versions simultaneously using the `uv python install` command. ```console $ uv python install 3.12 3.13 3.14 Installed 3 versions in 972ms + cpython-3.12.12-macos-aarch64-none (python3.12) + cpython-3.13.9-macos-aarch64-none (python3.13) + cpython-3.14.0-macos-aarch64-none (python3.14) ``` -------------------------------- ### Install uv with wget on macOS and Linux Source: https://github.com/astral-sh/uv/blob/main/docs/getting-started/installation.md Use wget to download and execute the uv installation script if curl is not available. ```console $ wget -qO- https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### Installing a Python version satisfying version constraints with uv Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/python-versions.md Install a Python version that meets specified version constraints using uv python install. ```console $ uv python install '>=3.8,<3.10' ``` -------------------------------- ### Install packages from a requirements.txt file with uv pip Source: https://github.com/astral-sh/uv/blob/main/docs/pip/packages.md Installs all packages listed in a standard `requirements.txt` file. ```console $ uv pip install -r requirements.txt ``` -------------------------------- ### Install uv with pipx Source: https://github.com/astral-sh/uv/blob/main/README.md Install uv as a Python application in an isolated environment using pipx. ```bash pipx install uv ``` -------------------------------- ### Install uv with pip Source: https://github.com/astral-sh/uv/blob/main/README.md Install uv as a Python package using pip. ```bash pip install uv ``` -------------------------------- ### Set Up Python with `setup-python` and `.python-version` Source: https://github.com/astral-sh/uv/blob/main/docs/guides/integration/github.md Use the `actions/setup-python` action with `python-version-file: ".python-version"` to set up Python, leveraging GitHub's cache for faster execution. ```yaml name: Example jobs: uv-example: name: python runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: "Set up Python" uses: actions/setup-python@v6 with: python-version-file: ".python-version" - name: Install uv uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 ``` -------------------------------- ### Seed virtual environment and start Jupyter Lab for pip magic support Source: https://github.com/astral-sh/uv/blob/main/docs/guides/integration/jupyter.md Initialize the virtual environment with `pip` using `uv venv --seed`, then start Jupyter Lab to enable `%pip install` magic commands within notebooks. ```console $ uv venv --seed $ uv run --with jupyter jupyter lab ``` -------------------------------- ### Initialize bare project with optional features Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/projects/init.md Demonstrates how to use the `--bare` option while explicitly opting into additional features such as adding a description, inferring author from Git, initializing VCS, and pinning a Python version. ```console $ uv init example-bare --bare --description "Hello world" --author-from git --vcs git --python-pin ``` -------------------------------- ### Run legacy Windows scripts with uv tool run Source: https://github.com/astral-sh/uv/blob/main/docs/guides/tools.md Demonstrates how to execute legacy setuptools scripts on Windows, with and without explicitly specifying the file extension. ```console $ uv tool run --from nuitka==2.6.7 nuitka.cmd --version ``` ```console $ uv tool run --from nuitka==2.6.7 nuitka --version ``` -------------------------------- ### Add a platform-specific dependency Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/projects/dependencies.md Add a dependency that is only installed on a specific platform by using environment markers. This example adds `jax` only for Linux systems. ```console $ uv add "jax; sys_platform == 'linux'" ``` ```toml [project] name = "project" version = "0.1.0" requires-python = ">=3.11" dependencies = ["jax; sys_platform == 'linux'"] ``` -------------------------------- ### Initialize a new project with uv_build Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/build-backend.md Use `uv init` to create a new project pre-configured to use the `uv_build` backend. ```console $ uv init ``` -------------------------------- ### Install a Python tool with uv Source: https://github.com/astral-sh/uv/blob/main/docs/index.md Install a command-line tool from a Python package globally for persistent use. ```console $ uv tool install ruff Resolved 1 package in 6ms Installed 1 package in 2ms + ruff==0.5.4 Installed 1 executable: ruff $ ruff --version ruff 0.5.4 ``` -------------------------------- ### Install uv with curl on macOS and Linux Source: https://github.com/astral-sh/uv/blob/main/docs/getting-started/installation.md Use curl to download and execute the uv installation script. ```console $ curl -LsSf https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### Initialize a new uv project in a new directory Source: https://github.com/astral-sh/uv/blob/main/docs/guides/projects.md Use `uv init` to create a new project with a specified name, then navigate into the project directory. ```console $ uv init hello-world $ cd hello-world ``` -------------------------------- ### Setup Environment for Cross-Compiling Windows Trampolines from macOS Source: https://github.com/astral-sh/uv/blob/main/crates/uv-trampoline/README.md Install necessary tools and Rust targets on macOS to prepare for cross-compiling Windows trampolines. ```shell brew install llvm cargo install cargo-xwin rustup toolchain install nightly-2025-11-02 rustup component add rust-src --toolchain nightly-2025-11-02-aarch64-apple-darwin rustup target add --toolchain nightly-2025-11-02 i686-pc-windows-msvc rustup target add --toolchain nightly-2025-11-02 x86_64-pc-windows-msvc rustup target add --toolchain nightly-2025-11-02 aarch64-pc-windows-msvc ``` -------------------------------- ### Initialize a new uv project in the current directory Source: https://github.com/astral-sh/uv/blob/main/docs/guides/projects.md Create a directory, navigate into it, and then use `uv init` to initialize a new project in the current working directory. ```console $ mkdir hello-world $ cd hello-world $ uv init ``` -------------------------------- ### Setup Environment for Cross-Compiling Windows Trampolines from Linux Source: https://github.com/astral-sh/uv/blob/main/crates/uv-trampoline/README.md Install necessary tools and Rust targets on Linux to prepare for cross-compiling Windows trampolines. ```shell sudo apt install llvm clang lld cargo install cargo-xwin rustup toolchain install nightly-2025-11-02 rustup component add rust-src --toolchain nightly-2025-11-02-x86_64-unknown-linux-gnu rustup target add --toolchain nightly-2025-11-02 i686-pc-windows-msvc rustup target add --toolchain nightly-2025-11-02 x86_64-pc-windows-msvc rustup target add --toolchain nightly-2025-11-02 aarch64-pc-windows-msvc ``` -------------------------------- ### Example of a frozen requirements.txt file Source: https://github.com/astral-sh/uv/blob/main/docs/guides/migration/pip-to-project.md This output shows a requirements.txt file generated by pip freeze, containing exact version pins for all installed packages. ```python annotated-types==0.7.0 anyio==4.8.0 fastapi==0.115.11 idna==3.10 pydantic==2.10.6 pydantic-core==2.27.2 sniffio==1.3.1 starlette==0.46.1 typing-extensions==4.12.2 ``` -------------------------------- ### Set Up Python with `setup-python` and `pyproject.toml` Source: https://github.com/astral-sh/uv/blob/main/docs/guides/integration/github.md Configure `actions/setup-python` with `python-version-file: "pyproject.toml"` to use the latest Python version compatible with the project's `requires-python` constraint. ```yaml name: Example jobs: uv-example: name: python runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: "Set up Python" uses: actions/setup-python@v6 with: python-version-file: "pyproject.toml" - name: Install uv uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 ``` -------------------------------- ### Invoke Local uv Development Version Source: https://github.com/astral-sh/uv/blob/main/CONTRIBUTING.md Examples of running the development version of uv with different commands, such as creating a virtual environment or installing packages. ```shell cargo run -- venv ``` ```shell cargo run -- pip install requests ``` -------------------------------- ### Install packages in a default virtual environment with uv Source: https://github.com/astral-sh/uv/blob/main/docs/pip/environments.md Demonstrates how uv automatically finds and uses the default virtual environment for subsequent commands like package installation. ```console $ uv venv $ # Install a package in the new virtual environment $ uv pip install ruff ``` -------------------------------- ### Sample main.py for a default application project Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/projects/init.md This Python file provides a basic `main` function, serving as an entry point for the application. ```python def main(): print("Hello from example-app!") if __name__ == "__main__": main() ``` -------------------------------- ### Example AWS Lambda Event Payload Source: https://github.com/astral-sh/uv/blob/main/docs/guides/integration/aws-lambda.md Defines a sample JSON payload for an AWS Lambda function, simulating an HTTP GET request to the root path. ```json { "httpMethod": "GET", "path": "/", "requestContext": {}, "version": "1.0" } ``` -------------------------------- ### View available options for the uv installation script Source: https://github.com/astral-sh/uv/blob/main/docs/reference/installer.md Pass --help directly to the installation script to display all available command-line options. Environment variables are generally preferred for consistency. ```console $ curl -LsSf https://astral.sh/uv/install.sh | sh -s -- --help ``` -------------------------------- ### Specify Python version for tool operations Source: https://github.com/astral-sh/uv/blob/main/docs/guides/tools.md Examples showing how to use the `--python` option to specify a particular Python interpreter for running, installing, or upgrading tools. ```console $ uvx --python 3.10 ruff ``` ```console $ uv tool install --python 3.10 ruff ``` ```console $ uv tool upgrade --python 3.10 ruff ``` -------------------------------- ### Add a Python version-specific dependency Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/projects/dependencies.md Add a dependency that is only installed for specific Python versions using environment markers. This example adds `numpy` for Python 3.11 and later. ```console $ uv add "numpy; python_version >= '3.11'" ``` -------------------------------- ### Install `flash-attn` with pre-installed build dependencies Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/projects/config.md Use `uv pip install` to pre-install build dependencies like `torch` and `setuptools` before running `uv sync` for `flash-attn`. ```console $ uv venv $ uv pip install torch setuptools $ uv sync ``` -------------------------------- ### Configure uv for PyTorch CPU-only Builds Source: https://github.com/astral-sh/uv/blob/main/docs/guides/integration/pytorch.md This pyproject.toml example configures uv to install CPU-only versions of torch and torchvision by defining a custom 'pytorch-cpu' index and associating the packages with it. ```toml [project] name = "project" version = "0.1.0" requires-python = ">=3.14.0" dependencies = [ "torch>=2.11.0", "torchvision>=0.26.0", ] [tool.uv.sources] torch = [ { index = "pytorch-cpu" }, ] torchvision = [ { index = "pytorch-cpu" }, ] [[tool.uv.index]] name = "pytorch-cpu" url = "https://download.pytorch.org/whl/cpu" explicit = true ``` -------------------------------- ### Install and verify Python on Windows Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/python-versions.md Demonstrates installing a specific Python version using uv on Windows, then verifying its registration and selection via the `py` launcher. ```console $ uv python install 3.13.1 ``` ```console $ py -V:Astral/CPython3.13.1 ``` -------------------------------- ### Configure multiple index sources for a dependency based on platform in pyproject.toml Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/projects/dependencies.md This example shows how to install `torch` from different PyTorch indexes (CPU or GPU) depending on the platform, by defining multiple sources with environment markers and explicit index configurations. ```toml [project] dependencies = ["torch"] [tool.uv.sources] torch = [ { index = "torch-cpu", marker = "platform_system == 'Darwin'"}, { index = "torch-gpu", marker = "platform_system == 'Linux'"}, ] [[tool.uv.index]] name = "torch-cpu" url = "https://download.pytorch.org/whl/cpu" explicit = true [[tool.uv.index]] name = "torch-gpu" url = "https://download.pytorch.org/whl/cu130" explicit = true ``` -------------------------------- ### Install tool with executables and additional dependencies using uv Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/tools.md Combine `--with-executables-from` and `--with` options for comprehensive tool installation. ```console uv tool install --with-executables-from ansible-core --with mkdocs-material ansible ``` -------------------------------- ### Self-update uv installed via standalone installer Source: https://github.com/astral-sh/uv/blob/main/docs/getting-started/installation.md Update uv when it was installed using the standalone installer. ```console $ uv self update ``` -------------------------------- ### Initialize a default application project with uv Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/projects/init.md Use `uv init` to create a new application project in a specified directory. This is the default project type. ```console $ uv init example-app ``` -------------------------------- ### Register a Plugin Entry Point in pyproject.toml Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/projects/config.md Registers `example_plugin_a` as a plugin under the `example.plugins` group, allowing the main application to discover it. ```toml [project.entry-points.'example.plugins'] a = "example_plugin_a" ``` -------------------------------- ### Install uv using the installer script in Dockerfile Source: https://github.com/astral-sh/uv/blob/main/docs/guides/integration/docker.md Install uv within a Dockerfile using its official installer script, requiring `curl` and `ca-certificates` to download the release archive. ```dockerfile FROM python:3.12-slim-trixie # The installer requires curl (and certificates) to download the release archive RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates # Download the latest installer ADD https://astral.sh/uv/install.sh /uv-installer.sh # Run the installer then remove it RUN sh /uv-installer.sh && rm /uv-installer.sh ``` -------------------------------- ### Install Package with uv pip install --system Source: https://github.com/astral-sh/uv/blob/main/docs/guides/integration/docker.md Use `uv pip install --system` to install a package directly into the system Python environment within a Docker container. ```dockerfile RUN uv pip install --system ruff ``` -------------------------------- ### Initialize Libraries.io API Key and Data Structures (Python) Source: https://github.com/astral-sh/uv/blob/main/scripts/popular_packages/pypi_10k_most_dependents.ipynb Sets up necessary imports, an empty API key placeholder, and dictionaries to store API responses for fetching PyPI package data. An API key from libraries.io/account is required. ```python """To update `pypi_10k_most_dependents.txt`, enter your `api_key` from https://libraries.io/account. The latest version is available at: https://gist.github.com/charliermarsh/07afd9f543dfea68408a4a42cede4be4. """ from pathlib import Path import httpx api_key = "" responses = {} ``` -------------------------------- ### Transition to beta pre-release with uv Source: https://github.com/astral-sh/uv/blob/main/docs/guides/package.md Use `--bump patch --bump beta` to increment the patch version and add a beta pre-release component. ```console $ uv version --bump patch --bump beta hello-world 1.3.0 => 1.3.1b1 ``` -------------------------------- ### Install uv on Windows Source: https://github.com/astral-sh/uv/blob/main/README.md Use this PowerShell command to install uv via the standalone installer on Windows systems. ```powershell powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" ``` -------------------------------- ### Verify an installed tool's version Source: https://github.com/astral-sh/uv/blob/main/docs/guides/tools.md Checks the version of an installed tool, confirming its successful installation and availability in the PATH. ```console $ ruff --version ``` -------------------------------- ### Initialize a Local Library and Add to Workspace Source: https://github.com/astral-sh/uv/blob/main/docs/guides/integration/aws-lambda.md Use these commands to create a new local library and add it to the current project's workspace, making it available for local dependencies. ```console $ uv init --lib library $ uv add ./library ``` -------------------------------- ### Run a legacy Windows Command Prompt script Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/projects/run.md Execute a legacy setuptools script with a `.cmd` extension on Windows, optionally requesting additional dependencies. ```console $ uv run --with nuitka==2.6.7 -- nuitka.cmd --version ``` -------------------------------- ### Initialize uv Project with Application Layout Source: https://github.com/astral-sh/uv/blob/main/docs/guides/integration/fastapi.md Initializes a uv project with an application layout, creating a pyproject.toml file. ```console $ uv init --app ``` -------------------------------- ### Install dependencies from pylock.toml Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/projects/layout.md Use this command to install packages listed in a `pylock.toml` file, ensuring consistent and reproducible installations. ```bash uv pip sync pylock.toml ``` ```bash uv pip install -r pylock.toml ``` -------------------------------- ### Sync with and without optional build dependencies Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/projects/config.md Demonstrates a two-step process to install build dependencies, then remove them after the main package is installed. ```console $ uv sync --extra build + cchardet==2.1.7 + cython==3.1.3 + setuptools==80.9.0 $ uv sync - cython==3.1.3 - setuptools==80.9.0 ``` -------------------------------- ### Install uv on macOS and Linux Source: https://github.com/astral-sh/uv/blob/main/README.md Use this command to install uv via the standalone installer on macOS and Linux systems. ```bash curl -LsSf https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### Install specific or latest tool versions Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/tools.md Use `uv tool install` with `@latest` or `@version` to control the version of the tool being installed. ```console $ uv tool install ruff@latest $ uv tool install ruff@0.6.0 ``` -------------------------------- ### Install Requirements from File with uv pip Source: https://github.com/astral-sh/uv/blob/main/docs/guides/integration/docker.md Copy a `requirements.txt` file into the container and install its dependencies using `uv pip install -r`. ```dockerfile COPY requirements.txt . RUN uv pip install -r requirements.txt ``` -------------------------------- ### List installed and available Python versions with uv Source: https://github.com/astral-sh/uv/blob/main/docs/guides/install-python.md Display a list of Python versions managed by uv, including those installed and those available for installation. ```console $ uv python list ``` -------------------------------- ### Start a specific marimo notebook with uvx Source: https://github.com/astral-sh/uv/blob/main/docs/guides/integration/marimo.md Use this command to open a particular marimo notebook file. ```console uvx marimo edit my_notebook.py ``` -------------------------------- ### Run a tool with arguments Source: https://github.com/astral-sh/uv/blob/main/docs/guides/tools.md Shows how to pass arguments to a tool invoked with `uvx`. ```console $ uvx pycowsay hello from uv ------------- < hello from uv > ------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || ``` -------------------------------- ### Install specific uv version with PowerShell on Windows Source: https://github.com/astral-sh/uv/blob/main/docs/getting-started/installation.md Install a specific version of uv on Windows by including the version number in the installer URL. ```pwsh-session PS> powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/0.11.19/install.ps1 | iex" ``` -------------------------------- ### Install specific uv version with curl on macOS and Linux Source: https://github.com/astral-sh/uv/blob/main/docs/getting-started/installation.md Install a specific version of uv by including the version number in the installer URL. ```console $ curl -LsSf https://astral.sh/uv/0.11.19/install.sh | sh ``` -------------------------------- ### Install a specific tool version Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/tools.md Install a tool with `uv tool install` using `==version` to make a precise version persistently available. ```console $ uv tool install ruff==0.5.0 ``` -------------------------------- ### Install dependencies from pylock.toml using uv pip install Source: https://github.com/astral-sh/uv/blob/main/changelogs/0.6.x.md This command installs dependencies specified in a `pylock.toml` file, treating it as a requirements file. ```bash uv pip install -r pylock.toml ``` -------------------------------- ### Update Project Version with `uv version` Source: https://github.com/astral-sh/uv/blob/main/changelogs/0.7.x.md Demonstrates initializing a project and using `uv version` to display, bump, and show the short form of the project's version. ```console $ uv init example Initialized project `example` at `./example` $ cd example $ uv version example 0.1.0 $ uv version --bump major example 0.1.0 => 1.0.0 $ uv version --short 1.0.0 ``` -------------------------------- ### Run a tool with extras and a specific version Source: https://github.com/astral-sh/uv/blob/main/docs/guides/tools.md Combines specifying extras with a precise version constraint using the `--from` option. ```console $ uvx --from 'mypy[faster-cache,reports]==1.13.0' mypy --xml-report mypy_report ``` -------------------------------- ### Add uv installer script to Dockerfile Source: https://github.com/astral-sh/uv/blob/main/docs/guides/integration/docker.md Adds the `uv` installation script from a specific URL to the Docker image, allowing for installation via the script. ```Dockerfile ADD https://astral.sh/uv/0.11.19/install.sh /uv-installer.sh ``` -------------------------------- ### Initialize a bare project with uv Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/projects/init.md Use the `--bare` option to create a project that includes only a `pyproject.toml` file, omitting a Python version pin, README, source directories, and VCS initialization. ```console $ uv init example-bare --bare ``` -------------------------------- ### Installing a specific Python version with uv Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/python-versions.md Use uv python install followed by a precise version number to install a specific Python version. ```console $ uv python install 3.12.3 ``` -------------------------------- ### Initialize a New Python Library with uv Source: https://github.com/astral-sh/uv/blob/main/docs/concepts/projects/init.md Use the `--lib` flag with `uv init` to create a new Python library project. This command implies `--package` and sets up a `src` layout for the library. ```console $ uv init --lib example-lib ```