UV is a really fast Python package and project manager just like Poetry, but better.

Installation

brew install uv

Note

Is a good recommendation to enable shell autocompletion for UV commands.

Useful Commands

CommandCategoryDescription
uv init <project_name> --app --lib --packageProjectCreates a new Python project with specified structure (application, library, or package)
uv add <package_name>ProjectAdds a package to pyproject.toml, updates uv.lock, and syncs your environment
uv add --dev <package_name>ProjectAdds a development dependency to pyproject.toml and syncs your environment
uv remove <package_name>ProjectRemoves the package from pyproject.toml, uv.lock, and syncs your environment
uv syncProjectCreates/updates virtual environment, builds dependency list, writes to uv.lock, and installs dependencies
uv lockProjectGenerates or updates the uv.lock file with resolved dependencies
uv lock --upgrade package <package_name>ProjectUpgrades a specific package in your uv.lock file according to version constraints
uv treeProjectDisplays the dependency tree for the current environment
uv python listPython EnvShows available and installed Python versions
uv python find <python_version>Python EnvLocates a specific Python version on your system
uv python install <python_version>Python EnvInstalls a specific Python version
uv python uninstall <python_version>Python EnvUninstalls a specific Python version
uv venv --python <python_version>Python EnvCreates a virtual environment with the specified Python version
uv python pin <python_version>Python EnvPins a specific Python version for your project
uv run main.pyRunRuns a Python script in the appropriate environment
uvx ruff <command>ToolsRuns the Ruff linter/formatter with specified command (shorthand for uv tool run)
uv tool run ruff <command>ToolsRuns the Ruff linter/formatter with specified command
uv tool dirToolsShows the directory where tools are installed
uv tool listToolsDisplays all installed tools
uv tool update-shellToolsUpdates shell configuration for tool access
uv tool install <tool_name>ToolsInstalls a Python tool globally
uv tool uninstall <tools_name>ToolsUninstalls a previously installed Python tool
uv tool upgrade <tool_name>ToolsUpgrades an installed Python tool to the latest version
uv buildProjectBuilds a Python package distribution
uv publishProjectPublishes a Python package to PyPI
uv self updateuvUpdates uv itself to the latest version