You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CI: fix wheel test-command shadowing + conda-forge libomp for macOS
Previous run produced a green test matrix (all 12 jobs) and sdist, but
all three build-wheels jobs failed. Two independent root causes:
1. Linux and Windows wheels BUILT fine, but cibuildwheel's test-command
failed with `ModuleNotFoundError: No module named 'wlsqm.fitter.defs'`.
Root cause: pytest's default `prepend` import mode walks up the
package tree from each test file looking for a `__init__.py`-less
ancestor, and inserts that ancestor into sys.path. With
`tests/__init__.py` present, pytest treated `tests/` as a package,
walked up to `/project`, and inserted `/project` into sys.path.
Python then resolved `import wlsqm` to `/project/wlsqm/` (source
tree, no compiled .so files) instead of the installed wheel at
`site-packages/wlsqm/`. The source-tree `__init__.py` does
`from .fitter.simple import *` which fails because `defs.pyx` isn't
a compiled module.
Fix: delete `tests/__init__.py` and change the three test files
that had `from .conftest import ...` to plain `from conftest import ...`.
Without `tests/__init__.py`, pytest stops the walk at `tests/` and
inserts `tests/` (not `/project`) into sys.path, which makes
`conftest` importable by bare name and leaves the installed wheel
visible at `site-packages/wlsqm/`. The test job is unaffected because
meson-python's editable loader intercepts `import wlsqm` regardless
of sys.path order.
Verified locally: `pytest tests/` still 57/57 green.
2. macOS wheel failed at compile time with:
`fatal error: 'omp.h' file not found`
Root cause: Cython's `cimport openmp` in simple.pyx, impl.pyx,
expert.pyx, and lapackdrivers.pyx unconditionally emits
`#include <omp.h>` in the generated C. Meson's
`dependency('openmp', required: false)` fallback only controls
whether `-fopenmp` is passed — it does not prevent Cython from
emitting the header include. Apple Clang ships no `omp.h`, so the
previous commit's "drop libomp entirely, fall back to serial"
approach was not actually a viable baseline on macOS.
Fix: install conda-forge's `llvm-openmp` via a standalone micromamba
in cibuildwheel's macOS before-all. conda-forge ships llvm-openmp
rebuilt with a conservative deployment target (11.0 on arm64,
matching cibuildwheel's default), so delocate-wheel is happy to
bundle the resulting `libomp.dylib` into the wheel without the
"Library dependencies do not satisfy target MacOS version" refusal.
CPPFLAGS / LDFLAGS / PKG_CONFIG_PATH / DYLD_FALLBACK_LIBRARY_PATH
are set in `[tool.cibuildwheel.macos].environment` so that meson
discovers libomp during the build and delocate finds it at
bundling time. Same pattern as scipy and numpy's macOS wheel CI.
Also add `.claude/` to .gitignore (Claude Code internals: the
scheduled_tasks lockfile was about to sneak into `git add -A`).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments