Switch recommended build workflow from conda to uv #557
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Our current recommended workflow for building these docs is to create a conda environment and build within it. One challenge we face with this is sometimes the upstream Sphinx theme changes things and breaks the layout. For most developers the local conda build environment only gets updates occasionally, so these breakages may not be immediately reproducible locally without clearing and recreating the environment.
We can solve this with
uv
and having auv.lock
file which ensures reproducible builds consistently. The only requirement is to haveuv
installed on your system and to prefix build commands withuv run
. The Python environment will be created dynamically using theuv.lock
. We can upgrade the lockfile by deleting it and running things again, the dependencies will be calculated from the specification inpyproject.toml
.This also means that is a PR modifies some dependencies or versions we don't need to worry about the local environment being in sync, just check out the PR and
uv run
will update the environment to match the newuv.lock
automatically. Switch back to main and the environment is put back again.Interactive development builds become:
Builds are also faster. Not a huge impact given that they are pretty quick already, but a conda based build takes around 1m9s and a uv build takes 29s.