Skip to content

Epic: Build EEGPrep external extension ecosystem #112

Closed
7 of 7 issues completed
Closed

Description

@suraj-ranganath

Summary

Build a long-term EEGPrep external extension system that lets researchers create, install, discover, manage, and use EEGPrep extensions without relying on EEGPrep-hosted zip uploads or manual maintainer-added GitHub issue entries.

The core principle is: EEGPrep extensions should feel familiar to EEGLAB plugin users, but distribution and loading should use modern Python packaging. External extension packages should be installed with standard package tooling, discovered through Python entry points, and registered through a stable EEGPrep extension SDK.

Why This Epic Exists

EEGLAB supports community plugins through eegplugin_*.m files and an extension manager. Historically, plugin submissions involved custom zip upload infrastructure and manual maintainer workflows. That does not scale well and creates avoidable security and maintenance risk.

EEGPrep should instead support:

  • normal Python package distribution through PyPI, GitHub, private package indexes, and editable local installs;
  • discovery via importlib.metadata entry points;
  • a stable declarative extension API for menus, pop_* functions, help resources, console aliases, and package data;
  • an Extension Manager that lists installed/curated extensions and gives users safe install/update guidance without EEGPrep downloading arbitrary zips;
  • authoring docs, a template package, and a Codex skill so researchers can build extensions quickly and correctly.

Branch Model

  • Epic branch: feature/eegprep-extension-completion
  • Start point: branch from the latest integrated EEGPrep feature line after the current standalone/STUDY and EEGBrowser stacked epics land, or from feature/eegbrowser-completion if this epic is started before those PRs merge.
  • Phase PR targets: feature/eegprep-extension-completion
  • Final epic PR target: origin/develop

Scope

In scope:

  • EEGPrep extension SDK and runtime registry.
  • Entry-point discovery group, likely eegprep.extensions.
  • Menu/action/help/console/session integration for external extensions.
  • Refactoring bundled plugins to use the same extension registration path where practical.
  • Extension Manager UX for installed, bundled, curated, disabled, incompatible, and failed extensions.
  • Curated extension catalog metadata model and validation, without hosting code artifacts.
  • Extension authoring docs, template package, examples, and an eegprep-extension-development Codex skill.
  • Cross-platform tests, import-time safety, lazy loading, and compatibility versioning.

Out of scope:

  • Hosting arbitrary extension zip files inside EEGPrep infrastructure.
  • Automatically installing untrusted code without explicit user action.
  • Running MATLAB EEGLAB plugins directly inside EEGPrep. Extensions should be Python packages; MATLAB bridges can be separate third-party extensions if their authors choose that dependency.

Phases

  1. Phase 1: Extension SDK, registry, discovery, and compatibility contract.
  2. Phase 2: Runtime integration for menus, actions, help, console, history, and bundled plugin migration.
  3. Phase 3: Extension Manager, installed-extension UX, curated catalog metadata, and safe install guidance.
  4. Phase 4: Researcher authoring toolkit, template package, examples, and scaffolding.
  5. Phase 4b: Extension docs, trust levels, and agent skill.
  6. Phase 5: Governance, security, catalog validation, compatibility policy, and extension test harness.
  7. Phase 6: Cross-platform hardening, performance, integration QA, and epic closeout.

Parallelization

  • Phase 1 must merge first because it defines the extension API and registry contract.
  • After Phase 1, Phases 2, 3, 4, 4b, and 5 can run mostly in parallel.
  • Phase 2 and Phase 3 must coordinate on the registry status model, but they can be separate PRs.
  • Phase 4 can start once the Phase 1 API is stable and owns templates/scaffolding/examples.
  • Phase 4b can start once the Phase 1 API names are stable and owns docs, trust-level explanation, and the eegprep-extension-development skill.
  • Phase 5 can start after Phase 1 and should feed governance/security constraints into Phases 3, 4, and 4b.
  • Phase 6 runs last after Phases 2, 3, 4, 4b, and 5 merge.

Recommended merge order: 1 -> 2 + 3 + 4 + 4b + 5 -> 6 -> final epic PR.

Epic-Level Acceptance Criteria

  • External EEGPrep extensions can be installed as Python packages and discovered through entry points.
  • A researcher can create a minimal extension package with a pop_* function, GUI menu item, help resource, and console alias using documented tooling.
  • Installed extensions can contribute menus and actions without breaking startup, GUI refresh, or eegprep-console workspace synchronization.
  • Extension failures are isolated, visible, logged, and do not crash EEGPrep.
  • Bundled plugins and external plugins share one coherent status/registry model.
  • Extension Manager clearly distinguishes bundled, installed, curated, disabled, incompatible, missing dependency, and failed extensions.
  • EEGPrep does not host or unzip arbitrary extension code as part of normal runtime.
  • Tests cover discovery, validation, duplicate actions, lazy loading, failed imports, menu integration, console/history behavior, package data/help resources, and cross-platform behavior.
  • Documentation explains how researchers install, build, test, publish, and submit extensions to the curated catalog.
  • uv run --no-sync ruff check ., uv run --no-sync ruff format --check ., uv run --no-sync ty check, and relevant pytest suites pass on the final epic branch.

Project Guidance

Follow:

  • AGENTS.md
  • .agents/skills/eegprep-feature-development/SKILL.md
  • .agents/skills/eeglab-gui-visual-parity/SKILL.md for Extension Manager GUI work
  • .agents/skills/gui-agent-flow-qa/SKILL.md for mixed GUI plus console QA
  • .agents/skills/github-pr-review/SKILL.md for phase review cycles

Sub-issues

Sub-issues

7 of 7 Issues completed
Loading 7 sub-issues

Activity

  1. added
    epic
    P1
    on Jun 2, 2026
  2. claude commented on Jun 2, 2026

    @claude
    Contributor

    🤖 Plan:

    Research

    This is a 6-phase epic, far over the >100 LOC threshold and explicitly out of scope for a single bug-fix PR. The repo already has placeholder plugin_menu.py that hardcodes the bundled inventory and a static eeglab_menu.py that imports each bundled plugin's menu factory by name; there is no SDK, no entry-point discovery, no failure isolation, and no version contract. Phase issues #113-#118 already decompose the work and exist open with the phase label, so this epic ticket needs design pointers, not a parallel implementation PR.

    Relevant code

    • src/eegprep/functions/adminfunc/plugin_menu.py#L14-L80 - hardcoded _BUNDLED_PLUGINS tuple; replace with a registry view.
    • src/eegprep/functions/guifunc/eeglab_menu.py#L6-L14 - static plugin menu imports; needs registry-driven injection point.
    • src/eegprep/functions/guifunc/menu_spec.py#L12-L29 - MenuItemSpec.origin already supports non-core origins; reuse for extension provenance.
    • src/eegprep/functions/guifunc/session.py#L92 - EEGPrepSession.PLUGINLIST exists as a sync target for the manager UI.
    • src/eegprep/plugins/firfilt/menu.py (and siblings under plugins/*/menu.py) - current per-plugin menu factories; migrate to registry-published specs in Phase 2.

    Proposed Approach (design pointers, not a PR)

    Do not open a PR against this epic. Implementation lives in the phase issues. Recommended ordering per the epic body: #113 → (#114, #115, #116, #117 in parallel) → #118 → final epic PR to develop.

    Phase 1 (#113) is the gating contract and should land first. Concrete shape that fits this repo:

    1. Entry-point group eegprep.extensions resolved via importlib.metadata.entry_points(group=...). Each entry point returns a small declarative descriptor (dataclass) with name, version, api_version, menu_items: tuple[MenuItemSpec, ...], pop_functions: dict[str, Callable], help_resources: dict[str, Path], console_aliases: dict[str, str]. Reuse the existing MenuItemSpec (origin already accepts extension names).
    2. Registry module in src/eegprep/functions/adminfunc/extensions.py (parallel to plugin_menu.py) that loads, validates, and caches descriptors with per-extension status (ok, incompatible, failed_import, missing_dep, disabled). Failures must be captured per extension; one bad entry point cannot crash startup. Replace _BUNDLED_PLUGINS with descriptors registered the same way (bundled plugins declare their own entry points in pyproject.toml [project.entry-points.\"eegprep.extensions\"]).
    3. Compatibility versioning: pin an integer EEGPREP_EXTENSION_API_VERSION and a min_eegprep field on descriptors. Skip-and-report on mismatch instead of importing.
    4. Lazy imports: descriptor returns module path strings for pop_* callables and resolves on first action invocation, so import-time cost of installed-but-unused extensions stays near zero.

    Phase 2 (#114) wires the registry into eeglab_menu.py (replacing the static imports) and into plugin_menu.py so the manager dialog lists installed + bundled + failed. Phase 3 (#115) extends that dialog with curated-catalog metadata (read-only JSON shipped in src/eegprep/resources/; no zip hosting). Phase 4 (#116) ships the template package + eegprep-extension-development skill. Phase 5 (#117) adds the catalog schema validator and test harness. Phase 6 (#118) does cross-platform + perf QA.

    Open questions for the human owner before Phase 1 starts:

    • Are bundled plugins (clean_rawdata, ICLabel, firfilt, dipfit, EEG_BIDS) expected to migrate to entry-point registration in Phase 1, Phase 2, or kept dual-registered through Phase 6? The epic body says "where practical" - needs a concrete cut-off.
    • Should the API version live as a single integer or as semver with a documented break policy?
    • Does the curated catalog ship inside the package (resources/curated_extensions.json) or as a separately fetched signed manifest? The "no zip hosting" rule does not by itself answer this.

    No implementation in this ticket; per-phase PRs will branch from feature/eegprep-extension-completion per the epic body.

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

Metadata

Metadata

Labels

P1epic

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions