decker-edu / decker

A markdown based tool for slide deck creation.
GNU General Public License v3.0
53 stars 13 forks source link

Update Thebelab to module syntax #76

Open kno10 opened 8 months ago

kno10 commented 8 months ago

There is some code for thebelab in

https://github.com/decker-edu/decker/blob/master/resource/decker/support/plugins/thebelab/thebelab.js

but it does not appear to be up-to-date (not using JavaScript modules like the other plugins).

E.g., something like

const Plugin = {
  id: "thebelab",
  init: (deck) => {
    // if (!deck.getConfig().thebelab) return;
    return new Promise(function (resolve) {
      thebelab.bootstrap();
      resolve();
    });
  },
};

export default Plugin;

I was looking into thebe-lite for Python code examples, but so far could not get it working.

monofon commented 8 months ago

The ThebeLab integration has been abandoned a few semesters ago, because nobody was using it anymore. I will start teaching programming again next winter, so the plan is to revive this (or something similar) sometime around next summer.

Until then, I am afraid, there is no easy way to make that work.

kno10 commented 8 months ago

Well, I got it working, largely using the code fragment above. With a custom and newer jupyterlite, too. This has some issues with the interaction of the reveal.js auto-sizing logic and the codemirror editor component, that still needs some sorting out. Also, reveal.js reacts to any ? keypress, so if you have to add a question mark in your code, the help screen will pop up.

mbotsch commented 8 months ago

Currently, the easiest solution for interactive python code is the server-based SageMath (which I know you don't like)

::: { .sageCell width=1200px height=500px }
``` python
import matplotlib.pyplot as plt
import numpy as np
so something fancy with python...

:::

kno10 commented 4 months ago

See https://github.com/kno10/decker/tree/thebe 63e21b0e53371b1a755383356ea0971542de06c6 for an updated thebe plugin.

monofon commented 2 months ago

I just found another contender: codapi.org

The server delegates code execution to language specific Docker images and talks to the client in a dead simple protocol. The server is easy to deploy and configure (I just did so at codapi.tramberend.de) and fast.

The whole thing is about 2 orders of magnitude lower in complexity as Jupyter Hub + Thebe. Plus, it does not use CodeMirror.

There is a working example at live-coding-deck.md.