Skip to content

Make uv resolve gpcca-fast without compiling PETSc#86

Merged
Marius1311 merged 1 commit into
mainfrom
fix/uv-petsc-resolve
Jul 16, 2026
Merged

Make uv resolve gpcca-fast without compiling PETSc#86
Marius1311 merged 1 commit into
mainfrom
fix/uv-petsc-resolve

Conversation

@Marius1311

Copy link
Copy Markdown
Member

Problem

Any bare uv command in this repo (uv sync, uv run, uv lock) tried to compile PETSc from source and failed. Root cause:

  • There is no committed uv.lock, so uv locks the entire dependency universe — including the opt-in gpcca-fast group (cellrank[petsc], slepc).
  • petsc4py/slepc4py ship no wheels and compute their metadata dynamically at build time, so uv had to build PETSc just to resolve — even with --no-default-groups (that only affects install, not locking).
  • On machines without a system BLAS on the linker path (isolated CI/uv build envs), PETSc's configure then fails with Could not find a functional BLAS. (Verified from the actual configure.log.)

Net effect: focused runs documented in AGENTS.md like uv run pytest tests/model were broken out of the box.

Fix

Add [[tool.uv.dependency-metadata]] entries that mirror the deps petsc4py/slepc4py inject at build time (petsc4py → petsc, slepc4py → petsc4py + slepc; the two library packages have no Python deps). uv now resolves and locks these from static metadata without ever building — resolves in ~5s. PETSc/SLEPc compile only when the gpcca-fast group is actually installed.

Also corrected the group's source-build comment, which was copied from CellRank's docs and only works where a system BLAS already exists; it now documents the pre-built conda-forge/pixi path as the recommended install, with a shared-BLAS source build as the fallback.

Verification

  • uv lockResolved 302 packages in 4.80s, no build.
  • uv sync --extra test → installs in ~11s, petsc4py correctly absent from .venv.
  • uv run pytest tests/test_utils.py19 passed.
  • hatch test tests/test_utils.py (unchanged path) → 19 passed.

Notes

  • uv.lock stays gitignored (library convention; hatch manages the test matrix and doesn't consume it). The static metadata is what unblocks resolution, so no lockfile is required.
  • Keep the dependency-metadata entries in sync with the gpcca-fast group.
  • The gpcca-fast runtime backend still builds from source only where a real BLAS is available; conda-forge binaries are the robust route (documented). Unchanged by this PR.

🤖 Generated with Claude Code

petsc4py/slepc4py compute their metadata dynamically at build time, so any
bare `uv sync`/`uv run`/`uv lock` compiled PETSc from source just to resolve
the dependency universe — and that source build fails on machines without a
system BLAS on the linker path (e.g. isolated CI/uv build envs), where PETSc
configure errors with "Could not find a functional BLAS".

Add [[tool.uv.dependency-metadata]] entries mirroring the deps petsc4py/
slepc4py inject at build time, so uv resolves them from static metadata
without ever building (resolves in ~5s). PETSc/SLEPc now compile only when
the gpcca-fast group is actually installed.

Also correct the (copied-from-CellRank) source-build recipe in the group
comment: the documented options provide no BLAS and fail here; document the
pre-built conda-forge/pixi path as the recommended install and a shared-BLAS
source build as the fallback.

uv.lock stays gitignored (library convention; hatch does not use it) — the
static metadata is what unblocks resolution, so no lockfile is required.
Local checks remain petsc-free via `hatch test` (features dev+test), which
never pulls this dependency group.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.37%. Comparing base (54aff95) to head (8a7de92).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #86   +/-   ##
=======================================
  Coverage   86.37%   86.37%           
=======================================
  Files          13       13           
  Lines        1387     1387           
=======================================
  Hits         1198     1198           
  Misses        189      189           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Marius1311 Marius1311 merged commit f68b451 into main Jul 16, 2026
8 of 9 checks passed
@Marius1311 Marius1311 deleted the fix/uv-petsc-resolve branch July 16, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant