Skip to content

feat: plugin model with SourcePlugin ABC, registry, and DataBroker#8

Merged
jschloman merged 4 commits intomainfrom
feat/plugin-model
Mar 29, 2026
Merged

feat: plugin model with SourcePlugin ABC, registry, and DataBroker#8
jschloman merged 4 commits intomainfrom
feat/plugin-model

Conversation

@jschloman
Copy link
Copy Markdown
Owner

Summary

  • Introduces SourcePlugin ABC with validate_schema() and a self-registering @register decorator + REGISTRY dict
  • Migrates Last.fm and Swarm loading into LastFmPlugin / SwarmPlugin (non-breaking wrappers around existing analysis_utils functions)
  • Adds DataBroker to coordinate loading, merging, and type-availability queries across plugins
  • 34 new unit tests covering schema validation, registry, both plugins, and all DataBroker behaviour; full suite 78/78 passing

Test plan

  • CI goes green (ruff, mypy, pytest --cov ≥80%)
  • streamlit run visualize.py still renders all 4 tabs correctly (no behaviour change)
  • Disabling Swarm config in sidebar → Spatial tab degrades gracefully

🤖 Generated with Claude Code

jschloman and others added 4 commits March 27, 2026 17:31
Introduces the Phase 1/2 plugin architecture from the expansion brief:
- plugins/sources/base.py: SourcePlugin ABC with validate_schema()
- plugins/sources/__init__.py: REGISTRY dict + @register decorator + load_builtin_plugins()
- plugins/sources/lastfm/loader.py: LastFmPlugin wrapping load_listening_data()
- plugins/sources/swarm/loader.py: SwarmPlugin wrapping load_swarm_data()
- core/broker.py: DataBroker coordinating load, merge, and type availability
- tests/test_source_plugins.py: 21 unit tests for schema validation, registry, and both plugins
- tests/test_broker.py: 13 unit tests for DataBroker load/merge/query behaviour

All 78 tests pass. Non-breaking: visualize.py and analysis_utils.py unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a Plugin System section to the README covering:
- Updated project structure tree with plugin directories
- Step-by-step guide to creating a SourcePlugin subclass
- Required schema columns per plugin type
- DataBroker usage example
- Updated Contributing section to reference CLAUDE.md and quality gate commands

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
assets/dashboard_mockup.png: high-fidelity mockup rendered with the
Deep Space Indigo palette showing sidebar nav, hero card, KPI row,
genre streamgraph, top-artists bar chart, pydeck check-in heatmap,
and activity calendar heatmap.

tools/generate_mockup.py: matplotlib script that regenerates the mockup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fixes all quality gate failures introduced by the mockup script:
- Remove unused imports (matplotlib.patches, FancyArrowPatch)
- Remove unused variable ry
- Rename unused loop variables to _icon, _i, _bar per ruff B007
- Break long map caption string into a named variable (E501)
- Drop unused ax parameter from card() helper; update all call sites
- Convert add_axes list literals to tuples (mypy arg-type)
- Convert imshow extent list to tuple (mypy arg-type)

Also updates CLAUDE.md Section 7 with a mandatory pre-push gate that
includes auto-fix steps, a two-stage verify pass, a common failure
pattern table, and an explicit rule that no PR should be opened until
the full gate passes locally.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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