Apr 15, 2025
curl or wget, or run pip install uv.pip install uv.Verify Installation:
uv in your terminal to check if it works and shows available commands.Manage Python Versions:
uv python list.uv python install <version> (e.g., uv python install 3.8).uv python find <version>.uv python uninstall <version>.Running Python Scripts:
uv run <script_name>.py to run a script.uv run --python <version> <script_name>.py.uv run --with <dependency> to install and run scripts with specific packages.uv init-script <script_name.py> --python <version> to set up Python version and dependencies.uv add-d-script <script_name.py> <dependency>.Creating a New Project:
uv init to set up project files and a git repository.main.py (entry point)pyproject.toml (detailed requirements file).gitignoreAdding/Removing Dependencies:
uv add <dependency> to install and add to pyproject.toml.uv remove <dependency> to uninstall the package and update the file.Virtual Environment Management:
Lock Files:
uv.lock file helps maintain exact versions of packages used in the project, useful for source control.uv sync to sync the virtual environment with the dependencies in pyproject.toml manually, or it runs automatically with uv run.uv pip.