This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
make test- Run all tests in current virtualenvmake diff_cover- Run tests and report diff coveragemake test-all- Run quality checks, all tests in every supported env (Python/Django versions) and Jasmine JS testspy.test- Basic pytest execution (after installing test requirements)py.test --cov-report html- Generate HTML coverage reporttox- Run tests on all supported Python/Django combinationstox -e quality- Run quality checks (pylint, pycodestyle, isort)tox -e jasmine- Run Jasmine JavaScript teststox -e docs- Build documentation and run quality checks
make qualityortox -e quality- Run all Python quality checksmake pylint- Run pylint outside of toxmake pycodestyle- Run pycodestyle outside of toxmake jshint- Run JavaScript lintingmake isort- Format imports with isort
make requirements- Install development environment requirementsmake requirements.js- Install JavaScript requirements for local developmentpip install -qr requirements/dev.txt --exists-action w- Install dev dependencies directly
make static- Gather all static assets for production (with webpack optimization)make static.dev- Gather static assets for developmentmake static.watch- Watch for static asset changes during development
make docs- Generate Sphinx documentation and open in browsertox -e docs- Build docs with quality checks
./manage.py migrate- Run Django migrationspython manage.py collectstatic --noinput- Collect static files
edx-enterprise is a pluggable Django application designed to run within edx-platform. It provides enterprise features to the Open edX platform, centered around the concept of Enterprise Customers (organizations that consume courses).
enterprise/- Core enterprise functionality and modelsconsent/- Data sharing consent managementintegrated_channels/- Third-party LMS integrations (Canvas, Blackboard, Cornerstone, Degreed, etc.)enterprise_learner_portal/- Learner portal API endpoints
EnterpriseCustomer- Represents an organization consuming coursesEnterpriseCustomerUser- Links users to enterprise customersEnterpriseCourseEnrollment- Enterprise-specific course enrollmentsEnterpriseCustomerCatalog- Content catalogs for enterprise customersEnterpriseCustomerReportingConfiguration- Reporting and analytics setup
The API is organized into views for different enterprise entities:
enterprise_customer.py- Customer managemententerprise_course_enrollment.py- Enrollment managemententerprise_customer_user.py- User managemententerprise_group.py- Group managementanalytics_summary.py- Analytics and reporting
Each channel (Canvas, Blackboard, Cornerstone, Degreed, etc.) follows a consistent pattern:
- Exporters - Transform edX data into channel-specific formats
- Transmitters - Send data to third-party systems via APIs
- Models - Store channel-specific configuration and transmission audit logs
- All new Python code must have 100% diff coverage
- High code quality standards enforced via pylint, pycodestyle, isort
- JavaScript tests use Jasmine framework
- Tests should use REST APIs rather than Python APIs when integrating with edx-platform
- Use REST APIs rather than Python APIs when possible for edx-platform integration
- Encapsulate Python API usage in modules/classes for future migration
- Extensive unit test coverage for all API clients
The project has an extensive migration history (240+ migrations). When creating new migrations:
- Follow Django best practices
- Test migrations thoroughly in both directions
- Consider data migration needs for existing enterprise customers
- Create new directory in
integrated_channels/ - Implement concrete subclass of
IntegratedChannelApiClient - Create channel-specific models extending
EnterpriseCustomerPluginConfiguration - Implement exporters and transmitters following existing patterns
- Add URL patterns and admin configuration
- Use
EnterpriseCustomer.objects.get()to retrieve customers - Leverage
EnterpriseCustomerUserfor user-customer relationships - Use enterprise catalog queries for content filtering
- Follow audit logging patterns for compliance
- Extend appropriate base views in
enterprise/api/v1/views/ - Use DRF serializers for data validation and transformation
- Implement proper permissions using enterprise RBAC
- Add comprehensive API documentation
- Backend: Django 4.2/5.2, Django REST Framework
- Frontend: Webpack, Sass, jQuery (legacy), Paragon components
- Database: PostgreSQL (with extensive migration history)
- Testing: pytest, tox, Jasmine
- Quality: pylint, pycodestyle, isort, jshint
- Integrations: REST APIs for third-party systems
- Security: Fernet field encryption, PGP support for sensitive data
- I'll always have to run the tests manually
Run a self-check on the diff before creating a PR or pushing:
- Compute effective LoC — exclude lockfiles, generated files, snapshots, and vendor code.
- Count effective touched files — exclude the above plus one-to-one test pairs.
- If effective LoC > 400 or effective files > 10, stop and propose a split before proceeding.
- Report the result inline before continuing.
- Search the codebase before assuming something isn't implemented
- Write comprehensive tests with clear documentation
- Follow Test-Driven Development when refactoring or modifying existing functionality
- Always write tests for new functionality you implement
- Keep changes focused and minimal
- Follow existing code patterns
- Prefer the
ddtpackage for parameterized tests to reduce code duplication
- Document new functionality in
docs/references/ - When you learn something important about how this codebase works (gotchas, non-obvious
patterns, integration quirks), capture it in the relevant
docs/references/file or indocs/architecture-patterns.md - These docs are institutional memory - future sessions (yours or others) will benefit from what you record here
- Uses pytest with Django integration
- Coverage reporting enabled by default
- PII annotation checks required for Django models