Using uv for package management#

What is uv#

uv is the package and environment tool used in this repository.

We use it to:

  • Resolve and lock dependencies.

  • Create reproducible development environments.

  • Run commands in the project environment.

  • Build distribution artifacts.

Why we use it in tidy3d#

  1. Dependency metadata lives in one place: pyproject.toml.

  2. uv.lock captures exact resolved versions for reproducible installs.

  3. uv sync --frozen and uv run --frozen keep local and CI behavior aligned.

How to install it#

See the development installation guide in this documentation, or follow the official uv docs for installation and project workflows.

Project workflow in this repo#

Create/update the development environment:

uv sync --frozen --extra dev

Run commands inside the managed environment:

uv run --frozen pytest
uv run --frozen pre-commit run --all-files

Update locked dependencies after changing dependency metadata:

uv lock

Dependency metadata#

Dependencies are defined in pyproject.toml:

  • Runtime dependencies under [project.dependencies].

  • Optional dependency sets under [project.optional-dependencies].

Publishing/building#

Build local distribution artifacts:

uv build --sdist --wheel

For publish configuration and authentication details, refer to the uv publishing guide.