uv
Install uv
Start a new Python project with uv
Go to the parent folder of where you’d like to create your project and type in:
$ uv init first
This will create a subfolder called first and 3 files in it:
- An empty file callde
README.md. - A sample python program called
main.py. - The initial project config file called
pyproject.toml
Add a new dependency with uv
uv add PACKAGE
For example to add Flask as a dependency:
uv add flask
Add a new development-time dependency
uv add --dev pytest
Add an optional dependency that is needed to some feature
uv add --optional FEATURE package
uv add --optional rate Flask-Limiter
View the dependency tree with uv
uv tree
GitHub Action with uv
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "**/requirements.txt"
Install the optional dependencies
uv sync --extra FEATURE