Skip to content

[pkg] Move dev tooling out of the wheel and clean dead code (Fable 5 Phase 5) - #201

Merged
suraj-ranganath merged 1 commit into
fable5/epicfrom
fable5/phase5-packaging-cleanup
Jun 12, 2026
Merged

suraj-ranganath merged 1 commit into
fable5/epicfrom
fable5/phase5-packaging-cleanup

Conversation

@suraj-ranganath

Copy link
Copy Markdown
Member

Move developer and parity tools (visual_capture, stage_comparison, the ICLabel measure loader, pop_reref_helper) out of the installed package into tools and scripts, make eeglabcompat import side-effect-free, and resolve packaged montages via importlib.resources. Drop the redundant eeglabio optional extra, fix the install and contributing docs, the README badge and the CI branch triggers, and delete several dead helpers and an unused parameter.

Fixes #198

Part of the Fable 5 Findings epic (#193); addresses issue #198.

Standalone/runtime hygiene:
- Move developer/parity tooling out of the installed wheel into tools/:
  visual_capture.py -> tools/visual_parity/, stage_comparison.py ->
  tools/eeg_bids/, iclabel_net_load_py_measures.py -> tools/iclabel/
  (refactored to import the canonical ICLabelNet, removing the
  float64/float32 model drift). pop_reref_helper.py -> scripts/.
- Make eeglabcompat import side-effect-free (lazy temp dir), so importing
  core modules no longer creates a temp directory at import time.
- Resolve the packaged montages dir via importlib.resources instead of a
  __file__ dirname chain in pop_load_frombids.

Dependencies & docs:
- Drop the redundant eeglabio optional extra that duplicated the mandatory
  dependency. eeglabio stays required (used transitively via mne.export for
  .set writing); installation docs updated to match.
- Remove conda-forge install instructions for this unpublished pre-release;
  make the EEGobj example in contributing.rst actually runnable.
- Fix the README docs badge and correct CI branch triggers (main -> develop).

Dead code:
- Remove _currentset_list (menu_actions), _reject_unsupported_options
  (pop_newcrossf), the unused withindex parameter (pop_chansel), the
  custom_randperm no-op wrapper (runica; hoist `import time`), an unraisable
  except in eegrej, and the unread top-level STUDY['preclust'] seed
  (_study_utils).
@claude

claude Bot commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 4m 10s —— View job


Code review — PR #201

  • Overall assessment: Needs changes (one likely CI regression to confirm; rest is clean, well-scoped cleanup)
  • Highest-risk area: .github/workflows/test.yml branch triggers
  • Merge recommendation: Needs changes

I verified the substantive removals and moves against their call sites; almost all of the diff is safe dead-code/packaging cleanup. One change looks like it could silently break CI.

Blocking

None.

Important

  • .github/workflows/test.yml — main → master trigger change. The push/PR triggers were switched from [ main, develop ] to [ master, develop ]. This repo's integration branch is main (the base of this stack and the repo's main branch), and there is no master branch in the remote. If main is indeed the default branch, this disables CI on every push/PR to main — the opposite of the intended "fix CI branch triggers." Please confirm the actual default branch name; if it is main, this should stay main (or include both). I can't query the default branch via the GitHub API from this environment, so flagging for you to verify. (I can't edit .github/workflows/* myself due to app permissions.)

Nits

  • tests/matlab/eeg_iclabelcompare_features.m / iclabel_compare_with_features_tmp.m now invoke ../../tools/iclabel/iclabel_net_load_py_measures.py. The relative path assumes MATLAB's CWD is tests/matlab/. That's a reasonable convention for parity scripts, but it's more position-dependent than the previous bare filename — worth a one-line note in the script if the run dir isn't already fixed. New harness correctly reuses the canonical eegprep.plugins.ICLabel.iclabel_net.ICLabelNet(mat_path) (signature matches), so the consolidation is sound.

Test gaps

None required for this change set. The behavioral edits are pure removals of unused params/helpers:

  • pop_chansel: _selected_string never consumed withindex, and no caller passed it to pop_chansel_selected_string, so dropping it is a no-op on output. Existing tests/test_guifunc_pophelp_chansel.py still covers the formatting.
  • runica.py (custom_randperm → direct rand_permutation), pop_newcrossf (_reject_unsupported_options was a no-op), menu_actions._currentset_list (no references), and eegrej._is_boundary_event (try/except around int(t) on an already type-checked numeric) are all confirmed unused/inert.

EEGLAB parity notes

  • _study_utils.ensure_study — top-level STUDY.preclust default removed. _default_preclust() seeded STUDY.preclust with erpclusttimes / specclustfreqs / erspclustfreqs / erspclusttimes. No EEGPrep code reads top-level STUDY["preclust"] (all real usage is STUDY.etc.preclust and cluster["preclust"]), so this is functionally dead and safe to drop. The only parity caveat: an EEGLAB-initialized STUDY carries these top-level defaults, so a round-tripped .study will differ structurally until EEGLAB's std_checkset re-adds them. Low risk — just confirm the removal is intentional and that STUDY save/load parity isn't asserted anywhere.
  • eeglabcompat._temp_dir() (lazy, side-effect-free temp dir) and pop_load_frombids (importlib.resources montage resolution) are correct improvements and keep runtime independent of on-disk module location, matching AGENTS.md packaging rules.
  • Dropping the redundant [eeglabio] extra is fine: eeglabio remains a core runtime dependency, so .set I/O is unaffected; the removed README "GitHub Pages" badge pointed at a non-existent pages.yml workflow.
    · branch fable5/phase5-packaging-cleanup

@suraj-ranganath

Copy link
Copy Markdown
Member Author

🤖 Specification (PR >500 LOC; full per-finding detail in #198, epic #193)

Problem. Developer/parity tooling shipped inside the installed wheel (visual_capture.py, stage_comparison.py, iclabel_net_load_py_measures.py, pop_reref_helper.py — none imported by runtime src); eeglabcompat created a temp dir as an import side effect, pulled in by 5 runtime importers; pop_load_frombids resolved packaged montages via a __file__ dirname chain; pyproject declared eeglabio both as a mandatory dependency and a redundant optional extra; install/contributing docs, the README badge, and CI branch triggers referenced things that do not exist; and several dead helpers / an unused parameter lingered.

Approach. Moved the four dev tools to tools/visual_parity/, tools/eeg_bids/, tools/iclabel/, and scripts/ (updating the test/cases.json/doc importers); the ICLabel loader now imports the canonical ICLabelNet, removing a float64/float32 model copy. Made eeglabcompat import side-effect-free (lazy temp dir), fixing all importers at once. Switched montage resolution to importlib.resources. Removed the redundant eeglabio extra, removed the conda-forge instructions, made the EEGobj doc example runnable, fixed the README badge and CI triggers (main -> develop). Deleted _currentset_list, _reject_unsupported_options, the custom_randperm no-op wrapper (hoisting import time), an unraisable except in eegrej, the unused withindex param, and the unread top-level STUDY['preclust'] seed.

eeglabio nuance. The finding's "never imported" premise was inaccurate: eeglabio is used transitively via mne.export.export_raw(fmt='eeglab') in pop_writeeeg and eeg_mne2eeg for .set writing. So it stays a mandatory dependency (correct); only the redundant optional extra was removed, and docs no longer tell users to install it separately.

Tests. import eegprep clean; EEGPREP_SKIP_MATLAB=1 uv run pytest on the affected subset (visual_parity, bids_preproc, public_api_examples, guifunc_pophelp_chansel, eegrej, study_clustering): all passing, MATLAB-gated skips only. pre-commit.py --changed-from origin/fix/fresh-uv-console clean. No behavior-changing edits outside the listed findings (an earlier out-of-scope drift into long_task/session/pop_newset was reverted; those are addressed upstream in 6cb7e14).

on:
push:
branches: [ main, develop ]
branches: [ master, develop ]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: important — The push/PR triggers were switched from main to master (this line and the pull_request line below). This stack's base and the repo's main branch are main, and there's no master branch in the remote — so if main is the default branch, this silently disables CI on every push/PR to main, the opposite of the intended fix. Please confirm the actual default branch name; if it's main, revert both lines back to [ main, develop ] (or include both).

@suraj-ranganath

Copy link
Copy Markdown
Member Author

🤖 Re: the .github/workflows/test.yml main → master flag — verified the actual branch topology, and the change is correct (the bot's assumption that main is the integration branch is the false positive it flagged for confirmation):

  • Default branch is develop (gh repo view --json defaultBranchRef → develop).
  • main does not exist on the remote (git ls-remote --heads origin main → empty), so the old [ main, develop ] trigger was firing CI on a non-existent branch.
  • master does exist (the docs-publish branch) and was previously never exercised by this workflow.

So [ master, develop ] enables CI on the two branches that actually exist — which is the intent of the finding (triggers referenced a non-existent main; master was never tested). No change needed here.

On the .m relative-path nit: the parity scripts already run with CWD tests/matlab/ by existing convention, so ../../tools/iclabel/... resolves; happy to add an inline note if preferred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant