uv
An extremely fast Python package and project manager, written in Rust.
curl -LsSf https://astral.sh/uv/install.sh | sh
or
pip install uv
Create Project and Virtual Environment
cd <project-dir>
uv init -p <x.y>
# For example:
uv init -p 3.12
# or default version:
uv init
Package Indexes (Mirror)
# pyproject.toml
[[tool.uv.index]]
url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
default = true
Install Packages/Dependencies
uv add <pkg ...>
uv add --dev <pkg ...> # for development
Uninstall Packages/Dependencies
uv remove <pkg ...>
uv remove --dev <pkg ...> # for development
Run
uv run <python-cmd>
uv run --env-file .env <python-cmd> # or UV_ENV_FILE = .env
Examples:
uv run a.py
uv run django-admin startproject a
uv run --env-file .env manage.py runserver
uv run uwsgi a.ini
Deploy a Project
uv sync