Skip to content
Ramdam17 edited this page Mar 29, 2026 · 1 revision

Introduction to uv

Presentation

uv is an extremely fast Python package and project manager, written in Rust. It replaces Poetry for HyPyP and is the recommended tool for all development work on the project.

Installation

uv can be installed on any OS — see the official instructions.

Once installed, open a shell on your local HyPyP Git directory and type the following:

uv sync

This creates a .venv virtual environment dedicated to the project and installs all required libraries within it. To include dev dependencies (tests, docs, linting...):

uv sync --group dev

To run a command within the project environment without activating it:

uv run pytest tests/
uv run jupyter lab

Managing dependencies

If you want to add a library to the project, do not use pip but type:

uv add your_lib_name

If this is a dependency required only for documentation, tests or development help (linter, formatter...):

uv add --group dev your_lib_name

For optional extras (e.g. shiny, numba, torch):

uv add --optional shiny your_lib_name

To remove a dependency:

uv remove your_lib_name

To update all packages to the latest compatible versions:

uv lock --upgrade

The pyproject.toml configuration file

On the root of the git folder, there is a pyproject.toml configuration file following the PEP 621 standard.

It contains all dependency and packaging information. It is not recommended to edit it manually for adding or removing packages — use uv add and uv remove instead.

The uv.lock file (committed to version control) pins exact versions of all transitive dependencies for reproducible installs.

For more information: https://docs.astral.sh/uv/concepts/projects/

Publish on PyPI

Once ready to publish a new version with pyproject.toml up to date:

uv build
uv publish

Warning: it is recommended to use API tokens. More info: uv publish documentation.

Update docs requirements

To update the doc on ReadTheDocs, run the script update_docs_requirements.sh.

Note: to test doc generation locally:

uv run python -m mkdocs build --clean --site-dir _build/html --config-file mkdocs.yml

To serve locally with a live-reload webserver:

uv run python -m mkdocs serve

Full documentation

If you want to dive deeper into uv usage, check the documentation: https://docs.astral.sh/uv/