Skip to main content

StepWise Open edX Plugin

<pypi stepwise-edx-plugin <Querium Stepwise Math hack.d Lawrence McDaniel

Open edX

Implements custom features for the Open edX LMS and Studio applications using the new pluggable extensibility model.

Implements the following

Querium StepWise Configuration API

Assigns the StepWise api server to use for the Open edX instance on which this plugin is installed. The api endpoint is: https://web.stepwisemath.ai/stepwise/api/v1/configuration

source code is located in stepwise_plugin/api/

Uses this Django model: https://web.stepwisemath.ai/admin/stepwise_plugin/configuration/

public url to the api: https://web.stepwisemath.ai/stepwise/api/v1/configuration

Provides a means to embed localization information about the user in CTA buttons that send the user from Wordpress to Open edX. The most common url presently is: https://web.stepwisemath.ai/stepwise/dashboard?language=es-419

source code is located in stepwise_plugin/dashboard/

The reverse case. Provides a generalized way to seamlessly map the user from the LMS to the most sensible marketing site. An example usage is the "Discover New" link in the LMS site header. The url, assigned inside lms.yml within MKTG_URL_OVERRIDES is, https://web.stepwisemath.ai/stepwise/marketing-redirector/?stepwise_page=learning-content/ and will redirect to https://stepwisemath.ai/learning-content/ for a US-based user.

Uses this Django model: https://web.stepwisemath.ai/admin/stepwise_plugin/marketingsites/

Localized html anchor tags

Same as above, but for html anchor tags. In addition to the URL mapping, these also require language translation of the text of the html element value, bearing in mind that we need to avoid changes to the edx-platform po files since we do not want to fork the edx-platform repo.

Uses this Django model: https://web.stepwisemath.ai/admin/stepwise_plugin/locale/

An example usage would be the "Blog" and "Privacy Policy" links in the LMS site footer. The following is added to the Mako template:

<%!
  from stepwise_plugin.locale.utils import anchor, language_from_request
%>

<%

  # figure out the best language code to use based on whatever we
  # know about this user.
  try:
    preferred_language = language_from_request(request) or 'en'
  except:
    preferred_language = 'en'

  # get a Python dict containing the url and element text.
  blog_dict = anchor('stepwise-locale-blog', preferred_language)
%>

and the link itself would take the form

    <a id="stepwise-locale-blog" href="${blog_dict.get('url')}">${blog_dict.get('value')}</a>

manage.py commands

# Create or update a Stepwise API server host configuration
./manage.py lms configure_stepwise_api --host 'https://stepwiseai01.querium.com/webMathematica/api/' --environment 'Production'

# Create or update a Stepwise marketing site configuration
./manage.py lms configure_stepwise_marketing_site --language en --site_url 'https://stepwisemath.ai/'

# Create or update Stepwise marketing site local html elements
./manage.py lms configure_stepwise_locale --element_id 'stepwise-locale-contact' --language 'es-419' --url 'https://mx.stepwisemath.ai/contact/' --value 'Contacto'

Getting Started

Install

Native

# where github-plugin is defined in .ssh/config
git clone git@github-plugin:QueriumCorp/stepwise-openedx-plugin.git -b main  /home/ubuntu/stepwise_plugin

sudo -H -u edxapp bash
source /edx/app/edxapp/edxapp_env
source /edx/app/edxapp/venvs/edxapp/bin/activate
pip install /home/ubuntu/stepwise_plugin
# DO NOT!! add this near the bottom of /edx/app/edxapp/edx-platform/lms/envs/common.py

# NO! NO! NO! NO! NO! NO! NO! NO! NO! NO! NO! NO!
INSTALLED_APPS.extend('stepwise_plugin')    # DO NOT DO THIS!!!!!!
# NO! NO! NO! NO! NO! NO! NO! NO! NO! NO! NO! NO!

# it turns out that Open edX finds this package of its own accord.
# magical!!! :O
# to run tests
sudo -H -u edxapp bash
source /edx/app/edxapp/edxapp_env
source /edx/app/edxapp/venvs/edxapp/bin/activate
pip install -r requirements/edx/testing.txt
cd ~/edx-platform
./manage.py lms test stepwise_plugin --settings=test

Local development

# Run these from within your edx-platform virtual environment
pip3 install pre-commit
pre-commit install
pip3 install black
python3 -m pip install flake8

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.

Notes regarding development with macOS M1

  1. To avoid problems with installing the edx-platform requirements, create your virtual environment with Python >= 3.9.x using the native installer from https://www.python.org/. which python should return /Library/Frameworks/Python.framework/Versions/3.9/bin/python3. Ignoring this advise will lead to very weird side effects. Note that this is true even though Lilac actually runs on Python 3.8.x

  2. Best to install openssl, openblas, zstd, mysql, and mysql-client with Brew. Using brew helps you avoid problems with gcc compilations and linking that have proven problematic on early releases of macOS 11 on M1. If you run into problems while pip installing mysql-client / MongoDBProxy / mongoengine/ pymongo /numpy / scipy / matplotlib then analyze the stack trace for any other straggling dependencies that I might have ommitted here that might also break due to the gcc compiler or linker, and try installing these instead with Brew.

  3. In addition to launching your virtual environment it also helps to set the following environment variables in your terminal window. Make sure you pay attention to any further suggestions echoed in Brew installation output:

export OPENBLAS=/opt/homebrew/opt/openblas/lib/
export LDFLAGS="-L/opt/homebrew/opt/openblas/lib -L/opt/homebrew/opt/mysql-client/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openblas/include -I/opt/homebrew/opt/mysql-client/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openblas/lib/pkgconfig /opt/homebrew/opt/mysql-client/lib/pkgconfig"

Shell Plus and iPython

The stepwise_edxapi module adds ipython and django-extensions to the stack. It is then possible to get an enhanced shell via:

tutor local exec lms ./manage.py lms shell_plus

Release files for stepwise-edx-plugin 14.0.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stepwise-edx-plugin 14.0.17
File Size Uploaded
stepwise-edx-plugin-14.0.17.tar.gz 24.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stepwise-edx-plugin 14.0.17
File Interpreter ABI Platform
stepwise_edx_plugin-14.0.17-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 58.4 kB

Release files / stepwise-edx-plugin-14.0.17.tar.gz

Download URL stepwise-edx-plugin-14.0.17.tar.gz
Size 24.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b57581b89ca19f9cdf3b0209f1d784cd888016977cd255b398cefd0ea9f3e6d3
BLAKE2b-256 checksum
How to use checksums
a0d9b2af259b2bbb3a51579f66e2e2d4a360db88c34b8d5f82ec39ba00adaf2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.15

Release files / stepwise_edx_plugin-14.0.17-py2.py3-none-any.whl

Download URL stepwise_edx_plugin-14.0.17-py2.py3-none-any.whl
Size 33.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c15304e03ef6d158bcc5678b75148e19c442096c8eb021da2bfa6affcde5c967
BLAKE2b-256 checksum
How to use checksums
a7c1170d579a3bebb1105dfe42658450246a7785763e49de532fd50afe96ced3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.15

Release history Release notifications | RSS feed

This release

14.0.17 This release

2 release files

14.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page