Skip to content

cookiecutter-openedx/cookiecutter-openedx-plugin

Repository files navigation

Cookiecutter Open edX Plugin

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

An Open edX Plugin that implements customizations for deployment to Kubernetes. Implements the following:

  • Hooks for openedx Django Signals for 'user_logged_in', 'user_logged_out', 'register_user', 'course_enrollment_created', 'certificate_created' and more. Demonstrates both the legacy, and the newer methodology for subscribing to and listening for the signals.
  • Scaffolding for waffle flag setup, including Django model initializations. These are currently only used to enable Django Signals.
  • A custom badges backend that is compatible with django-storages backend for Amazon S3

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

# OPTION 1: install as a PyPi package
echo "cookiecutter-openedx-plugin>=0.1.3" >> "$(tutor config printroot)/env/build/openedx/requirements/private.txt"

# OPTION 2: install as an editable requirement
echo "-e git+https://github.com/cookiecutter-openedx/cookiecutter-openedx-plugin.git" >> "$(tutor config printroot)/env/build/openedx/requirements/private.txt"

cat "$(tutor config printroot)/env/build/openedx/requirements/private.txt"
tutor images build openedx
tutor local quickstart

Install using Cookiecutter Github Actions Workflow

Add the following to your Cookiecutter Github Actions Build workflow

      - name: Add cookiecutter-openedx-plugin
        uses: openedx-actions/tutor-plugin-build-openedx-add-requirement
        with:
          pip-package: cookiecutter-openedx-plugin
          pip-package-version: "0.1.3"

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! cookiecutter-openedx-plugin 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

  • run black on modified code before committing.
  • run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
  • run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
  • run pre-commit run --all-files before pushing. see: https://pre-commit.com/

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.

  • requirements/edx/base.txt
  • requirements/edx/develop.txt,
  • requirements/edx/testing.txt

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