Send us a message and we'll get back to you shortly.
Running Python in an LMS usually means setting up server-side execution — containers, sandboxing, scaling, security. For every student who clicks "Run", a server somewhere has to spin up, execute code, and return the result. It works, but it's expensive, complex, and adds latency.
We wanted a different approach for Cubite, our multi-tenant platform for building and hosting learning management systems.
What if Python just ran in the browser? No server, no containers, no infrastructure to manage per learner.
That's what we built using Pyodide and EditorJS.
Pyodide is CPython compiled to WebAssembly. It runs the real Python interpreter directly in the browser — not a subset, not a transpiler, the actual CPython runtime. It supports NumPy, Pandas, Matplotlib, and hundreds of other packages from the Python ecosystem.
Key things that make it work for education:
Cubite uses EditorJS as its core content editor. Course creators, instructors, and content teams use it to build course materials, blog posts, and pages. EditorJS stores content as structured JSON blocks — each block is a self-contained unit with its own type, data, and rendering logic.
We needed a code editor block that:
So we built editorjs-code-editor — a custom EditorJS plugin with in-browser Python execution powered by Pyodide.
The plugin appears as a block in the EditorJS toolbar. Add it, write Python code, configure the language and visual style. The block saves as JSON alongside all other course content.
First you need to add Code Editor component in the page, blog post or the course your are drafting
Next You setup editable mode and enable Run button so students can run python code and for the last step is writing the code you want the student edit and run
The code block renders with syntax highlighting, a "Run" button, and a console output panel. When the learner clicks Run:
The plugin is built with React and CodeMirror 6. Here's what's under the hood:
Lazy loading — Pyodide is only loaded when a Python code block is present. Other language modes (JavaScript, HTML, CSS, SQL, JSON, YAML, Bash, and more) work without it.
Singleton pattern — One Pyodide instance per page, shared across all Python blocks. This keeps memory usage reasonable even with many code exercises on a single page.
Pre-installed packages — Course creators can configure packages to pre-install:
codeEditor: {
class: CodeEditor,
config: {
preinstallPackages: ['numpy', 'pandas'],
},
}
4 visual styles — Default, Bordered, Terminal, and Minimal. Each style can be configured per block, so course creators can match the code editor to their content design.
Dark mode — Automatically detects the site theme via data-theme, .dark class, or prefers-color-scheme.
We still use server-side execution for some use cases — Cubite also provides managed hosting and integration for Open edX and Moodle instances, which have their own code execution backends. But for Cubite's native LMS, browser-based execution via Pyodide has clear advantages:
| Server-side | Pyodide (browser) | |
|---|---|---|
| Infrastructure cost | Scales with users | Zero |
| Latency | Network round-trip | Instant |
| Security | Sandboxing required | Browser sandbox built-in |
| Offline support | No | Yes (after initial load) |
| Initial load time | Fast | ~20MB first load (cached) |
| Package ecosystem | Full | Pyodide-compatible subset |
For an LMS where the majority of exercises are introductory to intermediate Python, the tradeoff is worth it. Advanced use cases that need full package support or GPU access still route through server-side execution.
We've open-sourced the EditorJS code editor plugin:
editorjs-code-editor on GitHub — Live Demo
Install it:
npm install editorjs-code-editor
Features:
We're open-sourcing more of our 27 EditorJS plugins over time — interactive assessments, quizzes, and other education-focused blocks.
We're working on:
If you're building an LMS or any content platform that needs interactive code execution, give editorjs-code-editor a try. And if you need a full multi-tenant LMS with this built in, check out Cubite.
Looking to learn more about run python in browser, pyodide tutorial and interactive python learning ? These related blog articles explore complementary topics, techniques, and strategies that can help you master How to Run Python in the Browser Using Pyodide and EditorJS.