Skip to content

Phase 6b: public API and plugin packaging - #88

Merged
suraj-ranganath merged 4 commits into
feature/study-standalone-completionfrom
phase/6b-public-api-plugin-packaging
May 30, 2026
Merged

suraj-ranganath merged 4 commits into
feature/study-standalone-completionfrom
phase/6b-public-api-plugin-packaging

Conversation

@suraj-ranganath

Copy link
Copy Markdown
Member

🤖 Phase 6b public API, plugin-management, package-data, and examples hardening.

Summary

  • Expose completed GUI/session/console/admin/plugin helpers through the lazy eegprep.* public API without making import eegprep heavier.
  • Add a read-only bundled extension manager for in-repo plugins and wire File > Manage EEGPrep extensions to update EEGPrepSession.PLUGINLIST.
  • Expand package-data globs for packaged resources and plugin assets.
  • Add API docs, interactive console guidance, and a runnable public API/plugin example.
  • Add focused tests for lazy exports, lightweight import behavior, plugin metadata/session UX, package resources, and the new example.

GUI evidence

The plugin manager is intentionally read-only because #81 excludes external plugin repositories. EEGLAB plugin_menu.m was used as the parity reference for list/status/description hierarchy; the online EEGLAB install/update manager is not a static visual parity case.

eegprep-plugin-manager.png

Tests

  • uv run --no-sync ruff check .
  • uv run --no-sync ruff format --check .
  • uv run --no-sync ty check
  • ./pre-commit.py
  • uv run pytest tests/test_plugin_menu.py
  • uv run pytest tests/test_package_exports.py
  • uv run pytest tests/test_public_api_examples.py
  • uv run pytest tests/test_console_workspace.py
  • uv run --no-sync pytest tests/test_gui_main_window.py
  • EEGPREP_SKIP_MATLAB=1 uv run --no-sync pytest -m "not slow"
  • uv run --group release python -m build
  • Wheel inspection confirmed packaged help/headplot/montage/ICLabel resources and no eegprep/eeglab/ entries.
  • Clean venv wheel import/plugin/resource smoke passed.
  • QT_QPA_PLATFORM=offscreen plugin manager screenshot smoke passed.

Closes #81

@suraj-ranganath

Copy link
Copy Markdown
Member Author

🤖 GUI evidence for Phase 6b plugin-management UX.

EEGPrep implements a read-only bundled extension manager because external EEGLAB plugin install/update/remove workflows are out of scope for #81. EEGLAB plugin_menu.m was used as the parity reference for the plugin list/status/description hierarchy.

eegprep-plugin-manager.png

@claude

claude Bot commented May 30, 2026 •

Copy link
Copy Markdown
Contributor

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


Code review

  • Overall assessment: Looks good.
  • Highest-risk area: None identified.
  • Merge recommendation: Safe to merge.

Blocking

None.

Important

None.

Nits

  • tests/test_public_api_examples.py:11 resolves docs/source/examples/plot_public_api_and_plugins.py against the current working directory. The test passes when pytest is run from the repo root but breaks for any other cwd (e.g. running pytest from tests/). Deriving the path from __file__ would make it cwd-independent. (Inline comment posted.)

Test gaps

None — the new lazy exports, plugin metadata, session sync, dispatcher wiring, packaged resources, and example are all covered.

EEGLAB parity notes

None. The read-only bundled inventory mirroring plugin_status/plugin_menu semantics is appropriate given #81 explicitly excludes external EEGLAB plugin install/update/remove workflows. _show_extension_manager correctly falls back to a headless metadata-only sync when PySide6 or parent are absent, so console-only callers still get a populated session.PLUGINLIST.

Checked for correctness bugs, EEGLAB parity, data structure compatibility, changed-behavior tests, and CLAUDE.md/AGENTS.md compliance.
· Branch

Comment thread tests/test_public_api_examples.py Outdated


def test_public_api_and_plugins_example_runs() -> None:
example = Path("docs/source/examples/plot_public_api_and_plugins.py")

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: nit

This relative path is resolved against the current working directory, so the test only passes when pytest is invoked from the repo root. Running pytest from tests/ (or any subdirectory) makes runpy.run_path raise FileNotFoundError. Deriving the path from __file__ keeps the test cwd-independent.

Suggested change
example = Path("docs/source/examples/plot_public_api_and_plugins.py")
example = Path(__file__).resolve().parents[1] / "docs/source/examples/plot_public_api_and_plugins.py"

Reference:

def test_public_api_and_plugins_example_runs() -> None:
example = Path("docs/source/examples/plot_public_api_and_plugins.py")
runpy.run_path(str(example), run_name="__main__")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 21e5daa. The example path now resolves from __file__, and I verified tests/test_public_api_examples.py passes both from the repo root and from the tests/ directory.

@suraj-ranganath

Copy link
Copy Markdown
Member Author

Phase 6b scope re-audit complete.

I rechecked issue #81 against this PR after addressing Claude's cwd-dependent test nit. The implementation covers the intended public API lazy exports, bundled plugin-management UX, package resources, docs/examples, and lightweight import tests. I added one extra fast regression layer for the package/install surface:

  • verifies and entry points remain configured
  • verifies setuptools package-data globs include runtime help/headplot/montage/ICLabel resources
  • verifies the vendored tree remains excluded from packaged data

Additional verification run:

  • ============================= test session starts ==============================
    platform darwin -- Python 3.11.14, pytest-9.0.3, pluggy-1.6.0
    rootdir: /Users/suraj/.codex/worktrees/eegprep-study-epic/phase-6b-public-api-plugin-packaging
    configfile: pyproject.toml
    collected 188 items

tests/test_public_api_examples.py .... [ 2%]
tests/test_package_exports.py .......................................... [ 24%]
........................................................................ [ 62%]
................................................................ [ 96%]
tests/test_plugin_menu.py ...... [100%]

============================= 188 passed in 2.76s ============================== -> 188 passed

  • from : ============================= test session starts ==============================
    platform darwin -- Python 3.11.14, pytest-9.0.3, pluggy-1.6.0
    rootdir: /Users/suraj/.codex/worktrees/eegprep-study-epic/phase-6b-public-api-plugin-packaging
    configfile: pyproject.toml
    collected 0 items

============================ no tests ran in 0.00s ============================= -> 4 passed

  • All checks passed!
  • 1 file already formatted
  • All checks passed!

Pushed commit: .

@suraj-ranganath

Copy link
Copy Markdown
Member Author

Phase 6b scope re-audit complete.

I rechecked issue #81 against this PR after addressing Claude's cwd-dependent test nit. The implementation covers the intended public API lazy exports, bundled plugin-management UX, package resources, docs/examples, and lightweight import tests. I added one extra fast regression layer for the package/install surface:

  • verifies eegprep-gui and eegprep-console entry points remain configured
  • verifies setuptools package-data globs include runtime help/headplot/montage/ICLabel resources
  • verifies the vendored eeglab/** tree remains excluded from packaged data

Additional verification run:

  • uv run --no-sync pytest tests/test_public_api_examples.py tests/test_package_exports.py tests/test_plugin_menu.py -> 188 passed
  • from tests/: uv run --no-sync pytest test_public_api_examples.py -> 4 passed
  • uv run --no-sync ruff check tests/test_public_api_examples.py
  • uv run --no-sync ruff format --check tests/test_public_api_examples.py
  • uv run --no-sync ty check

Pushed commit: a81f552.

@suraj-ranganath

Copy link
Copy Markdown
Member Author

Merged the latest origin/feature/study-standalone-completion into Phase 6b and resolved the only content conflict.

Conflict resolution:

  • docs/source/user_guide/interactive_console.rst: preserved both new sections. Phase 5a/6a's STUDY/help shared-session guidance remains, and Phase 6b's bundled plugin inventory guidance remains below it.

Integration fix:

  • Updated tests/test_guifunc_pophelp_chansel.py so it verifies actual packaged help resource coverage under the broader Phase 6b recursive package-data globs, instead of requiring the old exact resources/help/*.md glob.

Verification:

  • uv run --no-sync pytest tests/test_public_api_examples.py tests/test_package_exports.py tests/test_plugin_menu.py tests/test_console_workspace.py tests/test_gui_main_window.py tests/test_guifunc_pophelp_chansel.py tests/test_study_metadata.py tests/test_gui_pop_study.py -> 356 passed
  • uv run --no-sync ruff check tests/test_public_api_examples.py tests/test_guifunc_pophelp_chansel.py src/eegprep/__init__.py src/eegprep/functions/adminfunc/plugin_menu.py src/eegprep/functions/guifunc/menu_actions.py
  • uv run --no-sync ruff format --check tests/test_public_api_examples.py tests/test_guifunc_pophelp_chansel.py
  • uv run --no-sync ty check

Pushed merge commit: 096b7c0. The PR is now clean against the epic branch.

@suraj-ranganath
suraj-ranganath merged commit a153ab0 into feature/study-standalone-completion May 30, 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