Skip to content

Commit 7be20c2

Browse files
jhaleclaude
andcommitted
Install demo extra explicitly instead of relying on group overlap
The no-PETSc CI leg installed gmsh/pyvista by hand to top up what the test group happened to already cover from the demo extra (matplotlib/networkx/scipy/numba). That overlap is incidental and would silently break if the test group's contents ever changed; install 'python/[demo]' directly so the intent is explicit. Also guard the unguarded slepc4py import in demo_half-loaded-waveguide.py, matching the try/except pattern already used for pyamg and pyvistaqt, rather than adding slepc4py to the demo extra (which would force a PETSc build on every demo-extra install for one demo that needs it). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 33ce74e commit 7be20c2

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

.github/workflows/ccpp.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,19 +150,18 @@ jobs:
150150

151151
- name: Build Python interface
152152
run: >
153-
pip install --group python/pyproject.toml:test 'python/'
153+
pip install --group python/pyproject.toml:test 'python/[demo]'
154154
--check-build-dependencies
155155
--no-build-isolation
156156
--config-settings=cmake.build-type="Developer"
157157
158158
- name: Check Python configuration
159159
run: python -c "from mpi4py import MPI; import dolfinx; assert not dolfinx.has_petsc; assert not dolfinx.has_petsc4py; assert dolfinx.has_superlu_dist"
160160

161-
- name: Install gmsh and pyvista (and dependencies)
161+
- name: Install system dependencies for gmsh and pyvista
162162
run: |
163163
sudo apt-get install libglu1-mesa libgl1 libxrender1 libxcursor1 libxft2 libxinerama1
164164
sudo apt-get install libegl1
165-
pip install gmsh pyvista
166165
167166
168167
- name: Run demos (Python, serial)

python/demo/demo_half-loaded-waveguide.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@
4848
from petsc4py import PETSc
4949

5050
import numpy as np
51-
from slepc4py import SLEPc
51+
52+
try:
53+
from slepc4py import SLEPc
54+
except ModuleNotFoundError:
55+
print("This demo requires slepc4py.")
56+
sys.exit(0)
5257

5358
import ufl
5459
from basix.ufl import element, mixed_element

0 commit comments

Comments
 (0)