Repository navigation
Phase 1: Move oct2py, psutil, and pyedflib out of the base install - #380
Merged
Merged
Conversation
oct2py drags in octave-kernel/ipykernel/pyzmq/debugpy/tornado, and psutil has no WebAssembly build; both now live behind new [eeglab] and [sys] extras instead of [project].dependencies, and both are included in [all]. pyedflib has zero imports under src/; nothing but a test fixture writer in tests/test_bids_load_frombids_helpers.py needs it, so it moves to the dev dependency group instead of becoming an unused extra. Not tested beyond `uv lock`/`uv sync` succeeding; behavior verified by later commits.
max_mem=None previously called psutil.virtual_memory() twice (once for the initial default, once as a retry when the block-size check failed), which broke unhelpfully now that psutil is optional. Resolve it once, at the top of asr_process, to a fixed DEFAULT_MAX_MEM_MB=64, matching the maxmem=64 default already used by asr_calibrate() and clean_asr() elsewhere in this plugin. The now-pointless retry (re-fetching the same value again) is removed in favor of failing fast. Updated test_utils_asr.py: dropped the psutil mocks in test_memory_management/test_memory_error_handling since asr_process no longer imports psutil, and added test_default_max_mem_works_without_psutil, which blocks the real psutil import via sys.modules to prove max_mem=None does not need it. Tested with `uv run pytest tests/test_utils_asr.py`.
get_eeglab('OCT') now catches the bare oct2py ImportError and re-raises
naming 'eegprep[eeglab]'. num_jobs_from_reservation's psutil ImportError
previously named a bare 'uv pip install psutil'; it now names
'eegprep[sys]' too. Verified manually with the real import blocked (and,
for the oct2py path, a stub EEGLAB checkout so get_eeglab reaches the
oct2py import at all): both raise the updated message.
Phase gate for #374: walks eegprep's base dependency closure in uv.lock (evaluating dependency markers against a synthetic Pyodide/ Emscripten environment, so e.g. greenlet correctly self-excludes), then checks each package against the official Pyodide package lock and, failing that, for a pure-Python (abi=none, platform=any) wheel on PyPI that micropip could install directly. One pre-existing gap is tracked as non-blocking: docopt (pulled in via pybids -> num2words) has no PyPI wheel at all. Fixing it would mean changing pybids's or num2words's own dependency tree, which is out of scope for this phase (no numerical/behavioral change, and pybids/mne/neo are explicitly not to be touched here); flagged in the script output and in the PR description for a maintainer decision. Tested by running the script directly: 0 failing, 1 known gap, exit 0.
Add install.rst sections for the MATLAB/Octave parity helpers (eeglab extra) and system-aware parallel job sizing (sys extra), and mention them in the all-extras examples in install.rst and README. Docs-only change, not separately tested beyond reading the rendered text.
Contributor
There was a problem hiding this comment.
An organization admin can add extra usage credits at claude.ai/admin-settings/usage.
Once credits are available, reopen this pull request to trigger a review.
Contributor
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
The extras split changes what a plain install provides and the ASR default changes numerical output for direct asr_process(max_mem=None) callers, so both need a user-facing note.
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #374
Phase 1 of epic #324: makes
micropip.install("eegprep")viable in a browser/WebAssembly environment by removing packages with no WebAssembly build from[project].dependencies.Changes
oct2pyto a new[eeglab]extra (gates the Octave runtime path ineeglabcompat.py).psutilto a new[sys]extra (gates memory-based job sizing inbids_preproc'sReservePerJob).pyedflibfrom[project].dependenciesentirely (see "pyedflib decision" below).[all]now includeseeglabandsys, so full installs are unaffected.asr_process.py'smax_mem=Noneno longer callspsutil.virtual_memory(). It resolves once, at the top of the function, to a fixedDEFAULT_MAX_MEM_MB = 64, matching themaxmem=64default already used byasr_calibrate()andclean_asr()elsewhere in this plugin. The retry that re-queriedpsutilwhen the block-size check failed is removed; it now fails fast withRuntimeError('Not enough memory')instead, since retrying with the same fixed constant would just repeat the identical failed check.misc.py'snum_jobs_from_reservationandeeglabcompat.py'sget_eeglab('OCT')now raiseImportErrornaming the exact extra (eegprep[sys]/eegprep[eeglab]) instead of a bareuv pip install psutilor an unguardedoct2pyimport.tools/check_pyodide_base_resolution.py, the phase-gate script: walks eegprep's base dependency closure fromuv.lock(evaluating dependency markers against a synthetic Pyodide/Emscripten environment, sogreenletcorrectly self-excludes), then checks each package against the official Pyodide package lock or, failing that, for a pure-Python wheel on PyPI. Currently: 0 failing, 1 known non-blocking gap (below).uv.lockregenerated;docs/source/user_guide/installation.rstandREADME.mddocument the new extras.pyedflib decision (reversible, flagging per issue instructions)
Removed outright per the issue's recommendation, since nothing in
src/imports it. One thing the issue's grounding missed:tests/test_bids_load_frombids_helpers.pyimportspyedflibdirectly to write a synthetic EDF fixture. Deleting it outright would break that test's collection, so it now lives in thedevdependency group (test-fixture-only, same treatment aspytest), never reaching published installs,[all], ormicropip.install. Posted the open question on #374; this is cheap to reverse if a[formats]extra is preferred instead.New finding: docopt (not blocking, flagged for a maintainer call)
The resolution-check script found that
docopt(pulled in viapybids -> num2words) has no wheel published on PyPI at all (sdist-only), which would independently blockmicropip.install("eegprep").num2wordsdeclares it as an unconditional dependency even though it's only imported bynum2words's own CLI entry point, never invoked bypybidsoreegprep. Fixing this would mean changingpybids's ornum2words's dependency tree, which conflicts with this phase's explicit non-goal ("no change to pybids, mne, or neo"), so it's tracked as a documented, non-blocking known gap in the check script rather than silently worked around. Flagging for a maintainer decision (likely anoverride-dependenciesentry in a later phase, or an upstream fix).Verification
./pre-commit.py --changed-from origin/develop,uv run --no-sync ruff check .,ruff format --check ., andty checkare all clean.EEGPREP_SKIP_MATLAB=1 uv run pytest tests -m "not slow"passes except one pre-existing, unrelated failure (test_pop_reref.py::PopRerefIcaRegressionTests::test_sample_data_average_reference_emits_no_runtime_warning, a BLAS divide-by-zero warning reproduced identically on the base commit before this branch's changes).tools/check_pyodide_base_resolution.pyexits 0. Added a real (not mocked) regression test that blocks thepsutilimport viasys.modulesand callsasr_process(..., max_mem=None)to prove that path no longer needs it.