Skip to content

[Extensions] Add authoring toolkit examples - #123

Merged
suraj-ranganath merged 2 commits into
feature/eegprep-extension-completionfrom
phase/4-extension-authoring-toolkit
Jun 3, 2026
Merged

suraj-ranganath merged 2 commits into
feature/eegprep-extension-completionfrom
phase/4-extension-authoring-toolkit

Conversation

@suraj-ranganath

Copy link
Copy Markdown
Member

Add a concrete extension template package, focused example extension packages, and a developer checklist for researcher-authored EEGPrep extensions. The included tests validate SDK registration, menu metadata, console/history behavior, help resources, package data, GUI cancel paths, optional dependencies, and no-plugins discovery behavior.

Closes #116

@claude

claude Bot commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

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


Code review

  • Overall assessment: Safe to merge.
  • Highest-risk area: Example/SDK API drift (verified — all imports, GUI spec, and console APIs match the current SDK).
  • Merge recommendation: Safe to merge.

I reviewed the full diff against origin/feature/eegprep-extension-completion and cross-checked every cross-module API the examples and tests depend on:

  • eegprep.extensions exports — ExtensionSpec/Action/Menu/PopFunction/Resource/Dependency, ExtensionRegistry, ExtensionStatus, validate_extension_spec, LazyImport, EXTENSION_API_VERSION, EXTENSION_ENTRY_POINT_GROUP — all present and used correctly.
  • GUI: inputgui(spec, initial_values, renderer) and the DialogSpec/ControlSpec/CallbackSpec fields match; the test renderers honor the real run(spec, initial_values=None) protocol; validate_numeric_range is a genuine callback (pop_resample.py, qt.py).
  • Console: EEGPrepConsoleWorkspace(session, exports=...), .namespace[...], and the ConsolePopResult.command contract all line up with the Phase 1 implementation.
  • Version gate: eegprep.__version__ == "0.2.23" satisfies the examples' eegprep_requires=">=0.2.23", so the toolkit test's status == INSTALLED assertions hold.
  • Collection scope: testpaths = ["tests"] excludes examples/, so the in-package eegprep_ext_template/tests/... (which imports the not-installed eegprep_ext_template) is not collected by CI — intended, since it runs only after copying. tests/test_extension_authoring_toolkit.py covers the same paths via monkeypatch.syspath_prepend.

Hand-checked test arithmetic: threshold count = 5 for the sample data at 0.25, per-channel centering → mean 0, CSV channel-major round-trip, and integer gain formatting ("EEG = pop_template_gain(EEG, 2);") are all correct.

Note: I could not execute the suite in this sandboxed environment (test commands required interactive approval), so the verification above is static + API-level rather than a live run.

Blocking

None.

Important

None.

Nits

  • Docs not updated for the new toolkit — docs/source/api/extensions.rst. AGENTS.md says to update Sphinx docs when adding user/developer-facing behavior, and there's already an extensions page that would be the natural home for a pointer. Consider adding a short "Authoring examples" link to examples/extensions/ (template + focused variants + DEVELOPER_CHECKLIST.md). Low severity; reasonable to defer to the broader extension-ecosystem phase. Fix this →

Test gaps

None. The new tests exercise SDK validation + lazy-target loading for all six packages, history commands, GUI cancel and invalid-input paths, packaged resource availability, console/session history sync, the optional-dependency failure path, and --no-plugins discovery. Coverage matches the changed behavior well.

EEGLAB parity notes

None blocking. The examples follow EEGPrep/EEGLAB conventions appropriately: channel-major (nbchan, pnts) data, deep-copy-before-mutate, (EEG, com) history returns with return_com=True, GUI cancel returning the original EEG and an empty command, and packaged help/sample-data resources independent of the EEGLAB checkout. The in-function import eegprep_template_optional_model in optional_model.py is an allowed optional-dependency guard, not an AGENTS.md "imports at top" violation.

Checked for correctness bugs, EEGLAB parity, data structure compatibility, changed-behavior tests, and CLAUDE.md/AGENTS.md compliance.
· phase/4-extension-authoring-toolkit

@suraj-ranganath

Copy link
Copy Markdown
Member Author

🤖 Specification for the >500-line Phase 4 authoring toolkit change.

Problem: Issue #116 needs concrete extension authoring assets that researchers can copy without understanding the full EEGPrep tree. The missing pieces were a full template package, focused examples for common extension types, a checklist, and tests that prove SDK registration plus package data/help/history patterns work. The core template contract is in examples/extensions/eegprep_ext_template/src/eegprep_ext_template/registration.py:20 and examples/extensions/eegprep_ext_template/src/eegprep_ext_template/pop_template_gain.py:17.

Approach: Add examples/extensions/ as non-installed authoring material. The full eegprep_ext_template package demonstrates pyproject entry point registration, ExtensionSpec metadata, a pop_* function, menu metadata, packaged help, packaged sample data, and copied-package tests. Five smaller example packages cover signal transforms, file import/export, GUI dialogs, plot/browser callbacks, and optional dependencies. The checklist lives in examples/extensions/DEVELOPER_CHECKLIST.md and stays implementation-focused so Phase 4b can own broader docs.

Key code: registration.py:20-59 declares the template ExtensionSpec with menu/action/pop/help/package-data resources. pop_template_gain.py:17-51 shows the pop_* mutation/history contract and GUI cancel behavior. pop_template_gain.py:54-79 shows the renderer-independent dialog spec and inputgui boundary.

Tests: tests/test_extension_authoring_toolkit.py:51-62 verifies install-mode docs and entry-point declarations. tests/test_extension_authoring_toolkit.py:65-87 validates every example spec and lazy target. tests/test_extension_authoring_toolkit.py:90-120 verifies template help/package data, console LASTCOM/ALLCOM updates, and history replay. tests/test_extension_authoring_toolkit.py:123-185 covers --no-plugins, sample-data transforms, file I/O, GUI cancel/failure, browser callbacks, and optional dependency failure.

@suraj-ranganath
suraj-ranganath force-pushed the phase/4-extension-authoring-toolkit branch from b30931f to e9c0693 Compare June 3, 2026 00:41
@suraj-ranganath
suraj-ranganath merged commit f4bed09 into feature/eegprep-extension-completion Jun 3, 2026
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