Skip to content

Commit 2619fa9

Browse files
garth-wellsclaude
andcommitted
Spack CI: install mypy with pip rather than through spack
mypy checks the sources; it is not a dependency of the build. Adding py-mypy to the environment puts it on the concretized DAG and in the build cache, and pins whatever version the packages ref carries. Install it with pip in the step instead. '--user', because the environment's view is spack-managed, and invoke it as a module so the script directory does not need to be on PATH. The step then echoes 'mypy --version'. This step is expected to report errors, so without that line a failed install and a working mypy finding problems would look the same in the log. Not verified locally: reproducing it needs a spack environment in the container, and the ones from the cache warm are gone. If pip refuses to install into that python, the version line will be missing and the cause will be obvious from the log. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent bcec176 commit 2619fa9

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ jobs:
155155
${{ matrix.petsc_dep }} ^adios2~libcatalyst~fortran~sz
156156
spack -e ci add py-fenics-dolfinx@main${{ matrix.petsc && '+petsc4py+slepc4py' || '~petsc4py~slepc4py' }} commit=${{ github.sha }} build_type=Developer
157157
spack -e ci add py-gmsh ^gmsh~med~fltk+external ^opencascade~draw py-pyamg py-matplotlib \
158-
py-mypy py-networkx \
158+
py-networkx \
159159
py-numba ^llvm~clang~lldb~lld~offload~libomptarget~polly targets=x86 \
160160
py-pytest py-pytest-xdist py-scipy \
161161
"py-pyvista ^[virtuals=gl] osmesa"
@@ -232,11 +232,21 @@ jobs:
232232
shell: spack-bash {0}
233233
run: |
234234
spack env activate ci
235+
# Installed with pip rather than added to the environment: mypy
236+
# is a check on the sources, not a dependency of the build, and
237+
# this keeps it off the concretized DAG and the build cache.
238+
# '--user' because the environment's view is spack-managed;
239+
# invoke it as a module so PATH does not matter.
240+
pip install --user mypy
241+
# Echo the version, so an install failure is distinguishable
242+
# from mypy running and reporting errors -- this step is
243+
# expected to report errors.
244+
python -m mypy --version
235245
DISABLE_FLAGS="--disable-error-code import-not-found --disable-error-code no-any-unimported"
236246
cd dolfinx-src/python
237-
mypy --config-file pyproject.toml -p dolfinx $DISABLE_FLAGS
238-
mypy demo $DISABLE_FLAGS
239-
mypy test $DISABLE_FLAGS
247+
python -m mypy --config-file pyproject.toml -p dolfinx $DISABLE_FLAGS
248+
python -m mypy demo $DISABLE_FLAGS
249+
python -m mypy test $DISABLE_FLAGS
240250
241251
- name: Set default DOLFINx JIT options
242252
run: |

0 commit comments

Comments
 (0)