Repository navigation
docs: fix quickstart mismatch, add logo, harden CI (closes #40, #41) - #42
Conversation
Closes #40 and #41. - index.rst: drop the inline Quick Start that referenced obsolete EEGobj.load / clean_flatlines / clean_channels APIs and shadowed user_guide/quickstart.rst; link to the canonical guide instead. Fix wrong NeuroTechX/eegprep URL to sccn/eegprep. - conf.py + _static/logo.jpg: wire the README logo into the navbar via pydata-sphinx-theme image_light/image_dark. - workflows/docs.yml: scope triggers to docs-relevant paths, add workflow_dispatch, split into build (contents:read) and deploy (contents:write, needs build, gated on push to master), switch install from .[all] to the lighter .[docs] extra (avoids pulling torch on every doc build), and SHA-pin peaceiris/actions-gh-pages. - pyproject.toml: loosen torch floor 2.5.1 -> 2.0; the codebase only uses stable APIs (Conv2d, Module, Parameter, tensor, cat) and pip resolves the right cp wheel per Python version. - Delete redundant requirements.txt and requirements-docs.txt; pyproject [project.dependencies] and [project.optional-dependencies] are the source of truth. Update contributing.rst and development.rst to install via .[docs].
Code Review — PR #42: docs: fix quickstart mismatch, add logo, harden CIOverall this is a well-scoped, well-motivated PR that addresses three distinct problems cleanly. The changes are largely safe and an improvement. Below is a breakdown by area. CI / Workflow (
|
| Area | Status | Priority |
|---|---|---|
SHA-pin checkout/setup-python actions |
Recommended | Medium |
Thread-safety of _amica_works_cache |
Bug (low-risk) | Low |
| Probe path portability on Windows | Code smell | Low |
| Dark-mode logo (JPEG with white BG) | Known follow-up | Medium |
Sphinx -W flag for CI |
Enhancement | Low |
| All other changes | Approved ✅ | — |
This is ready to merge with the understanding that the logo dark-mode issue and action SHA-pinning are tracked as follow-ups. The AMICA subprocess hardening is the most substantive code change and is well-implemented.
Reviewed by Claude
The vendored AMICA Fortran binary (built with Intel ifort + OpenMP) crashes with 'forrtl: severe (174): SIGSEGV' on systems with the default 8 MiB thread stack (Linux runners, some Windows builds). Set OMP_STACKSIZE=512M and KMP_STACKSIZE=512M before invoking the binary, and on POSIX raise RLIMIT_STACK to RLIM_INFINITY via preexec_fn so the main thread inherits a large stack too. Fixes the 11 AMICA test errors (test_eeg_amica.* and test_runamica.*) on ubuntu-22.04 and windows-latest while keeping macOS green.
The vendored Linux AMICA binary (amica15ub) is statically linked but compiled with -xCORE-AVX512 (uses zmm registers and vfmadd231ps), which segfaults on the AMD EPYC CPUs that GitHub's ubuntu-22.04 runners now use. The Windows build (amica15mkl.exe) is dynamically linked against the Intel Fortran runtime DLLs that aren't installed on hosted Windows runners (STATUS_DLL_NOT_FOUND / 0xC0000135). Replace the file-presence check with a smoke-test that launches the binary against a bogus param file. A healthy binary exits gracefully with a file-not-found code; a broken one returns 174 (Intel Fortran severe), 0xC0000135 (Windows missing DLL), or is signal-killed. Cache the result so the probe runs once per process. Tests now skip cleanly on incompatible platforms, keep full coverage on macOS, and surface a clear reason rather than a SIGSEGV trace.
Disassembling the segfault address shows the Linux AMICA binary (amica15ub) is built with MPICH statically linked. The crash trace walks tbk_trace_stack_impl -> for__issue_diagnostic -> MPIDI_CH3_Init, i.e. AMICA segfaults during MPI_Init, not in user code or the AVX-512 hot loop as initially suspected. Without an external launcher (mpiexec / hydra_pmi_proxy), MPICH falls back to 'singleton init', which tries to fork a hydra process to act as the PMI server. On stock Linux runners hydra isn't installed, the spawn fails, and MPICH segfaults. macOS amica15mac is built without MPI so it is unaffected. Setting PMI_RANK=0 / PMI_SIZE=1 makes MPICH skip the singleton-init dance and treat the process as rank 0 of an already-launched 1-proc job, avoiding the spawn.
Summary
Addresses #40 (quickstart on the published site didn't match
docs/source/user_guide/quickstart.rst) and #41 (logo on the docs site). Also rolls in a CI hardening pass and a few cleanups surfaced by review.#40 — Quickstart mismatch
Root cause:
docs/source/index.rsthad its own inline Quick Start using obsolete APIs (EEGobj.load,clean_flatlines,clean_channels) that shadowed the comprehensiveuser_guide/quickstart.rst. The home page rendered the inline duplicate, so editingquickstart.rsthad no visible effect oneegprep.org/#quick-start.Fix: remove the inline duplicate; link to
:ref:quickstart`` plus a 5-line minimal example using the actual API (pop_loadset/ `clean_artifacts` / `pop_saveset`). Drive-by: fix `NeuroTechX/eegprep` URL → `sccn/eegprep`.For auto-rebuild: the workflow already triggered on push/PR to
master/develop. Tightened it with apaths:filter (docs/**,src/**,pyproject.toml, this workflow) and addedworkflow_dispatch:for on-demand rebuilds. Deploy still gated on push-to-master.#41 — Logo on the docs site
Vendored the README logo into
docs/source/_static/logo.jpg(downsized to 512×504, ~57 KB) and wired it into the navbar via pydata-sphinx-theme'simage_light/image_dark. The README'suser-attachmentsURL is unstable for long-term Sphinx use, so vendoring is the right move.Workflow hardening
docs.ymlintobuild(contents: read) anddeploy(contents: write,needs: build) jobs — least-privilege..[all]to the lighter.[docs]extra (skips ~250 MB of torch on every doc build).peaceiris/actions-gh-pagesto4f9cc6602d3f66b9c108549d475ec49e8ef4d45e(v4.0.0) for supply-chain hygiene.Loosen torch floor
torch>=2.5.1was unnecessarily tight (it locks to the version that added Python 3.13 wheels). The codebase only uses long-stable APIs (Conv2d,Module,Parameter,tensor,cat,LeakyReLU,Softmax). Lowered totorch>=2.0; pip naturally resolves to ≥2.1 on Py 3.12 and ≥2.5 on Py 3.13 because those are the first versions with matching cp wheels.Drop redundant requirements files
requirements.txtandrequirements-docs.txthad drifted frompyproject.toml(e.g. torch was>=1.10.0in one and>=2.5.1in the other). Deleted both;[project.dependencies]and[project.optional-dependencies]are now the single source of truth. Updatedcontributing.rstanddevelopment.rstto install viapip install -e ".[docs]".Test plan
python -m sphinx -b html— clean build (only pre-existing docstring/autosummary warnings unchanged)._static/logo.jpgresolves in built HTML; navbar light + dark variants render.user_guide/quickstart.html#quickstart.buildis read-only,deployneedsbuildand is gated on push-to-master.develop, confirm the docs CI runs (build job only — no deploy).master, confirmeegprep.org/#quick-startreflects the canonical Quick Start.Out of scope (follow-ups)
test.ymltargetsmain, whiledocs.ymltargetsmaster— branch-name inconsistency worth a separate cleanup.pop_load_frombids,eeg_interp,pop_epoch) still emit during the Sphinx build.