cookiecutter-openedx / openedx-plugin-example

Python-Django scaffolding for common use cases
GNU Affero General Public License v3.0
16 stars 7 forks source link

Open edX Plugin Examples

Source code Forums Documentation PyPI releases AGPL License hack.d Lawrence McDaniel

An Open edX plugin showcasing a curated collection of code samples for extending and modifying the stock functionality of an Open edX installation using the built-in plugin architecture. This plugin can be installed in any Open edX installation version Juniper or later, independent of the installation method. This plugin currently runs in native builds, tutor installations, and Cookiecutter-openedx Kubernetes, amongst other proprietary installation methodologies.

Open edX official documentation recommends that you leverage its plugin architecture rather than fork its code repositories. This project provides more than two dozen code examples to help you accomplish this.

Watch the video

Usage:

pip install openedx-plugin-example

Technical features and coding techniques that are showcased in this repo include:

Open edX Plugins in this Repository

openedx_plugin

Demonstrates how to create an all-in-one Open edX plugin, with a heterogeneous collection of custom feature additions, including:

openedx_plugin_api

Implements a full-featured REST API which is built from snippets of Open edX's built-in rest api libraries. Demonstrates the following:

openedx_plugin_cms

Implements a custom course audit report in Course Management Studio that depends on a backend Python process to iterate the course content. This process is highly instructive about the Open edX course object hierarchy. This plugin demonstrates the following:

openedx_plugin_mobile_api

Implements a modified version of the Open edX LMS Mobile REST API. This plugin illustrates best practices for modifying edx-platform source code without actually forking this repository. Demonstrates the following:

Getting Started

Install using Tutor

See Installing extra xblocks and requirements

tutor config save       # to ensure that tutor's root folder system has been created
echo "openedx-plugin-example" >> "$(tutor config printroot)/env/build/openedx/requirements/private.txt"
tutor images build openedx
tutor local launch

# you'll also need to run this on your very first install
# -----------------------------------------------------------------------------

# 1. run migrations
tutor local run lms ./manage.py lms makemigrations
tutor local run lms ./manage.py lms migrate
tutor local run cms ./manage.py cms makemigrations
tutor local run cms ./manage.py cms migrate

# 2. add configuration data to custom models
tutor local run lms ./manage.py lms openedx_plugin_init
tutor local run lms ./manage.py lms openedx_plugin_api_init
tutor local run lms ./manage.py lms openedx_plugin_mobile_api_init
tutor local run cms ./manage.py cms openedx_plugin_cms_init

Notes About Django-Waffle

Documentation

Documentation is available here: Documentation

Support

To get community support, go to the official Open edX discussion forum: https://discuss.openedx.org.

Contributing

We welcome contributions! openedx-plugin-example is part of the cookiecutter-openedx project. Pull requests are welcome in all repos belonging to this organization. You can also contact Lawrence McDaniel directly.

Getting Started With Local development

# Run these from within your edx-platform virtual environment
python3 -m venv venv
source venv/bin/activate

cd /path/to/edx-platform
pip install -r requirements/edx/base.txt
pip install -r requirements/edx/coverage.txt
pip install -r requirements/edx/development.txt
pip install -r requirements/edx/pip-tools.txt
pip install -r requirements/edx/testing.txt
pip install -r requirements/edx/doc.txt
pip install -r requirements/edx/paver.txt

pip install pre-commit black flake8
pre-commit install

Local development good practices

edx-platform dependencies

To avoid freaky version conflicts in prod it's a good idea to install all of the edx-platform requirements to your local dev virtual environment.

At a minimum this will give you the full benefit of your IDE's linter.