This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a sample plugin repository that demonstrates all major Open edX plugin interfaces. It serves as a comprehensive example for developers new to Open edX plugin development.
Key Context:
- Primary Goal: Educational - show developers how to extend Open edX without modifying core platform code
- Plugin Types Demonstrated: Django App Plugin, Events (signals), Filters, Frontend Slots, Tutor Plugin
- Real Business Logic: Course archiving functionality (not just hello-world examples)
- Target Audience: Developers new to Open edX plugin development
Repository Structure:
backend-plugin-sample/- Django app plugin with models, APIs, events, and filtersfrontend-plugin-sample/- React component for MFE slot customizationtutor-contrib-sample/- Tutor plugin for easy deployment- Each directory has comprehensive README.md files with TOCs
When Making Changes:
- Prioritize educational value and clear examples over production optimization
- Always link to official Open edX documentation rather than duplicating it
- Maintain working integration between all plugin types
- Keep examples realistic but not overly complex
Key Files and Their Relationships:
backend-plugin-sample/openedx_plugin_sample/apps.py- Plugin registration and Django integrationbackend-plugin-sample/openedx_plugin_sample/signals.py- Open edX Events handlersbackend-plugin-sample/openedx_plugin_sample/pipeline.py- Open edX Filters implementationbackend-plugin-sample/openedx_plugin_sample/models.py- CourseArchiveStatus model (business logic)backend-plugin-sample/openedx_plugin_sample/views.py- REST API endpoints consumed by frontendfrontend-plugin-sample/src/plugin.jsx- React component that replaces course list slottutor-contrib-sample/tutorsample/plugin.py- Deployment configuration (currently basic template)
- Make sure to set the following so that test output is not too verbose:
export PYTEST_ADDOPTS="--disable-warnings --no-header --tb=short" - Backend testing:
cd backend-plugin-sample && pytestorcd backend-plugin-sample && make test - Run a single test:
cd backend-plugin-sample && pytest tests/test_models.py::test_placeholder - Quality checks:
cd backend-plugin-sample && make quality - Install requirements:
cd backend-plugin-sample && make requirements - Compile requirements:
cd backend-plugin-sample && make compile-requirements
- Python: Follow PEP 8 with max line length of 120
- Use isort for import sorting
- Document classes and functions with docstrings
- Type hints are encouraged but not required
- Error handling should use appropriate exceptions with descriptive messages
- Use pytest for testing, with descriptive test function names
- Frontend uses React and follows standard JSX conventions
Always run make quality and fix issues before creating a PR to ensure consistent code style.
- Primary Goal: Preserve teaching value - don't optimize away clarity for performance
- Official Docs: Always link to official Open edX documentation rather than duplicating explanations
- Integration Focus: Ensure all plugin types continue to work together as demonstration
- Realistic Complexity: Keep examples practical but not overly complex
- Backend ↔ Frontend: CourseArchiveStatus API in
views.pyconsumed byfrontend-plugin-sample/src/plugin.jsx - Events ↔ Models: Signal handlers in
signals.pycan update models inmodels.py - Settings ↔ Filters: Filter registration in
settings/common.pymust match classes inpipeline.py - Apps.py ↔ All: Plugin configuration affects URL routing, settings, and signal registration
- API Development: Use
perform_create()/perform_update()in viewsets for business logic - Settings: Use additive approach for
OPEN_EDX_FILTERS_CONFIGto avoid plugin conflicts - Frontend: Use Paragon components and
getAuthenticatedHttpClient()for platform integration - Events: Import signal handlers in
apps.py ready()method for proper registration - Filters: Return dictionaries with same parameter names as input, handle all scenarios