Skip to main content

This is a plugin for Tutor that makes it easy to integrate Jupyter notebooks in Open edX. It achieves the following:

  1. Install the official jupyter-xblock in the Open edX LMS and Studio.

  2. Run a Docker-based JupyterHub instance with a Docker spawner.

In practice, it means that students will be allocated Docker containers with limited CPU and memory to run their custom notebooks.

⚠️ Compatibility with Kubernetes was not battle-tested. Please report any issue you face. For a more production-ready Kubernetes environment, you are encouraged to check the documentation of the Zero to JupyterHub with Kubernetes project.

Installation

tutor plugins install jupyter

Usage

Enable the plugin:

tutor plugins enable jupyter

Re-build the “openedx” Docker image to install the Jupyter XBlock:

tutor images build openedx

Launch your platform again:

tutor local launch

Print the default passport ID:

echo "$(tutor config printvalue JUPYTER_DEFAULT_PASSPORT_ID):$(tutor config printvalue JUPYTER_LTI_CLIENT_KEY):$(tutor config printvalue JUPYTER_LTI_CLIENT_SECRET)"

Make a note of the printed value. Go to the Studio Tools ➡️ Advanced Settings ➡️ LTI Passports. Insert the passport value:

Studio advanced settings

In “Advanced Module List” add “jupyter” (with quotes):

Studio advanced settings

You should then be able to create an advanced Jupyter XBlock in the Studio:

> Add New Component ➡️ Advanced ➡️ Jupyter notebook

The default “hello” notebook will be pulled from the jupyter-block repository and displayed in the studio.

Configuration

Settings

This plugin has the following Tutor settings. Each setting can be printed with tutor config printvalue JUPYTER_SETTING_NAME and modified with tutor config save --set JUPYTER_SETTING_NAME=value.

Default settings:

  • JUPYTER_DOCKER_IMAGE_HUB (default: "{{ DOCKER_REGISTRY }}overhangio/jupyterhub:{{ JUPYTER_VERSION }}")

  • JUPYTER_DOCKER_IMAGE_LAB (default: "{{ DOCKER_REGISTRY }}overhangio/jupyterlab:{{ JUPYTER_VERSION }}")

  • JUPYTER_HOST (default: "jupyter.{{ LMS_HOST }}")

  • JUPYTER_DEFAULT_PASSPORT_ID (default: "jupyterhub")

  • JUPYTER_LTI_CLIENT_KEY (default: "openedx")

  • JUPYTER_HUB_MYSQL_DATABASE (default: "jupyterhub")

  • JUPYTER_HUB_MYSQL_USERNAME (default: "jupyterhub")

  • JUPYTER_LAB_CPU_LIMIT (default: None)

  • JUPYTER_LAB_MEMORY_LIMIT (default: "200M")

Unique, user-specific settings:

  • JUPYTER_HUB_COOKIE_SECRET (default: "{{ 32|jupyterhub_crypt_key }}")

  • JUPYTER_HUB_CRYPT_KEY (default: "{{ 32|jupyterhub_crypt_key }}")

  • JUPYTER_HUB_MYSQL_PASSWORD (default: "{{ 24|random_string }}")

  • JUPYTER_LTI_CLIENT_SECRET (default: "{{ 24|random_string }}")

JupyterHub

The configuration template for the JupyterHub instance is stored in jupyterhub_config.py. This template file includes a {{ patch("jupyterhub-config") }} statement, which means that its contents can be overridden by creating an ad-hoc Tutor plugin. For instance, to add custom LTI keys to your JupyterHub instance:

To modify the “jupyterhub” Docker image and add extra Python packages (for example), you should create a Tutor plugin that implements the “jupyterhub-dockerfile” patch:

Then build the JupyterHub image again:

tutor config save
tutor images build jupyterhub

Lab environment

By default, Jupyter lab notebooks will be spawned that do not include extra Python packages or dependencies. To modify the “jupyterlab” Docker image and add extra Python packages (for example), you should create a Tutor plugin that implements the “jupyterlab-dockerfile” patch:

Then build the lab image again:

tutor config save
tutor images build jupyterlab

You should now be able to run import matplotlib statements within your Jupyter notebooks.

Troubleshooting

This Tutor plugin is maintained by Abdul-Muqadim from Edly. Community support is available from the official Open edX forum. Do you need help with this plugin? See the troubleshooting section from the Tutor documentation.

License

This work is licensed under the terms of the GNU Affero General Public License (AGPL).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tutor_jupyter-22.0.0.tar.gz (20.5 kB view details)

Uploaded Source

File details

Details for the file tutor_jupyter-22.0.0.tar.gz.

File metadata

  • Download URL: tutor_jupyter-22.0.0.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.10

File hashes

Hashes for tutor_jupyter-22.0.0.tar.gz
Algorithm Hash digest
SHA256 51ea09c0c0f577af7fa467de708b39d25410e91b38ea13e20f7e8d8c00ec4526
MD5 817a178e512488e40918cf71e6a49ee4
BLAKE2b-256 c041fd2be46c6f7807fb237e0e217cf20b49e0a4e6a82519342a447245c26059

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

22.0.0 This release

1 file

21.0.0

1 file

20.0.0

1 file

19.0.0

1 file

18.1.1

1 file

18.1.0

1 file

18.0.0

1 file

17.0.0

1 file

16.0.1

1 file

16.0.0

1 file

15.0.2

1 file

15.0.1

1 file

15.0.0

1 file

0.1.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page