Jupyter, JupyterLite, marimo, Observable Notebook integration for Mathics3
Project description
Mathics3 Module for notebook frontends
This library provides helper functions for integrating Mathics3 into notebook environments. Currently, it supports Jupyter(Lite), marimo, and Observable.
JupyterLite
See Mathics3 live project a project that uses this Python module in a live demo running under pyodidie.
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
%load_ext mathics3_kernel.frontend.jupyter
Usage is as simple as executing the above code in a notebook cell, and then Mathics3 code can be directly run in all subsequent cells. Here is a sample notebook that can be used with a local Jupyter installation.
marimo
from mathics3_kernel.frontend.marimo import mathics3
Then run Mathics3 code like so:
mathics3("ArcCos[0]")
See the examples directory for a sample notebook:
marimo edit --sandbox examples/marimo_notebook.py
It also works in marimo's pyodide-powered online environment, see https://marimo.io/p/@davidar/mathics for an example.
Observable
For other notebook environments, this library provides a generic interface:
from mathics3_kernel.frontend.generic import mathics3
See https://observablehq.com/@davidar/mathics for an example of how this can be used with Observable notebooks. This notebook loads the library with pyodide, then implements a simple interface in JavaScript:
async function mathics3(strings) {
const [type, result] = await py`${mathics3_kernel}(${strings[0]})`
if (type === "code") {
return md`\`\`\`\n${result}\n\`\`\``;
} else if (type === "math") {
return tex.block`${result}`;
} else if (type === "json") {
return JSON.parse(result);
} else if (type === "html") {
return html`${result}`;
} else {
return result;
}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mathics3_notebook_frontends-1.0.0.tar.gz.
File metadata
- Download URL: mathics3_notebook_frontends-1.0.0.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19315d8556f4604475044144d17d6905e660a4882c62373cd33f0b7f9556dfe6
|
|
| MD5 |
d656bae9b3214280b0479e3cf2d89ab6
|
|
| BLAKE2b-256 |
a626b39268b726ac9b88a84f06bc599950484ccf76a531f04b843787ce5e09d7
|
File details
Details for the file mathics3_notebook_frontends-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mathics3_notebook_frontends-1.0.0-py3-none-any.whl
- Upload date:
- Size: 23.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff71d5972ffc3a65c378228889d80f95e8ee65779f4bd6687c3449a907342795
|
|
| MD5 |
960f3138742e508c731f177a6cfceafa
|
|
| BLAKE2b-256 |
e8be38bb970822c88c7ed8a4067b77d02db8e5d23516f5b0fe346574c3438298
|