Skip to main content

munchboka-edutools

Reusable Sphinx / Jupyter Book directives and assets for Norwegian educational content.

NEW: Includes muncho - a command-line tool for building beautiful, print-ready books with enhanced typography, layout, and automatic LaTeX math rendering for PDFs. See CLI_README.md for details.

Key Features

✨ Auto-configured Sphinx extensions for Jupyter Book
📚 Custom educational directives (quiz, dialogue, plots, animations, etc.)
🖨️ Print-optimized PDF builds with proper typography
🧮 Automatic PDF math rendering - LaTeX expressions work seamlessly in PDFs
🎨 Multiple build profiles (print, web, custom)
🎬 Animated plots - Create animations with transparent backgrounds (WebP/GIF)
📄 Print-friendly CSS - Browser "Print to PDF" creates clean problem sheets with answer keys

Install

pip install munchboka-edutools

Optional (nicer progress bars during slow builds, e.g. interactive-graph frame generation):

pip install munchboka-edutools[progress]

Usage

As Sphinx Extensions (Jupyter Book _config.yml)

sphinx:
  extra_extensions:
    - munchboka_edutools

All packaged directives are auto-registered. Static assets (including print-friendly CSS and JS) are placed under _static/munchboka/ during the build.

The core styles and scripts for part, answer, solution, goals, proof, and hint automatically retry failed downloads twice, after 300 ms and 600 ms. Retries preserve stylesheet order and use a fresh query parameter to bypass a cached failure. This lets transient failures recover without a page refresh. Rebuild and redeploy your book after upgrading to include the recovery handlers in its HTML. Persistent network failures still require connectivity to return.

Interactive 3D math graphs

backend: threejs is the default for interactive-plot3d, giving live rotation, zoom, and sliders with local renderer assets and a static print fallback. The legacy frames backend is still available via an explicit backend: frames. See the Three.js guide for examples and migration limits.

Norwegian notebooks with Pyodide

Build a standalone JupyterLite site, or use the {notebook} directive to open .ipynb exercises from a book. Students run Python in their browser and download their work as standard Jupyter notebooks.

pip install "munchboka-edutools[notebook]"
muncho notebook build --output _build/notebook
python -m http.server 8000 --directory _build/notebook

The default site includes three Norwegian examples. See the notebook guide for Sphinx integration, custom exercises, browser storage, and package limitations.

Print-Friendly PDFs

Simply press Ctrl+P (or Cmd+P) in your browser when viewing any page to create a clean PDF with:

  • All tabs flattened with part labels (a, b, c, etc.)
  • Answers and solutions hidden from main content
  • Automatic answer key page at the end
  • CAS popup buttons hidden
  • Better page breaks

See docs/print_pdf.md for details.

As Build Tool

Build books with enhanced formatting:

# Print-optimized build (includes automatic PDF math rendering)
muncho build matematikk_1t --profile print

# Web-optimized build
muncho build matematikk_r1 --profile web

# See all options
muncho --help

PDF Math Rendering: When building PDFs, muncho automatically configures sphinx.ext.imgmath to render LaTeX math expressions as high-quality SVG images. No changes to your source files needed!

See CLI_README.md for full CLI documentation and QUICKSTART.md for a quick start guide.

Development

Clone and install dev extras:

pip install -e .[dev]

Local demo book

Build the embedded demo book:

jupyter-book build book/

Adding a new directive

  1. Create src/munchboka_edutools/directives/my_directive.py exposing setup(app).
  2. The package auto-loads modules under munchboka_edutools.directives.
  3. Add an example page in book/examples/.

Testing

Run tests:

pytest -q

To exercise asset recovery in a browser (requires Node.js and Playwright):

pytest tests/test_asset_recovery.py --basetemp=/tmp/munchboka-asset-tests
node tests/asset_recovery_browser.cjs /tmp/munchboka-asset-tests/test_core_asset_recovery0/out

Set MUNCH_CHROMIUM to a Chrome executable if Playwright's Chromium is not installed.

Releasing

Tag a version (v0.1.0) and the GitHub Action will build and publish.

License

MIT

Metadata

Release files for munchboka-edutools 0.10.6

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

Source distribution (sdist)

Source distribution for munchboka-edutools 0.10.6
File Size Uploaded Provenance Actions
munchboka_edutools-0.10.6.tar.gz 44.4 MB Without provenance Details for munchboka_edutools-0.10.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for munchboka-edutools 0.10.6
File Interpreter ABI Platform Actions
munchboka_edutools-0.10.6-py3-none-any.whl Python 3 none any Details for munchboka_edutools-0.10.6-py3-none-any.whl

Total release size: 47.9 MB

Release files / munchboka_edutools-0.10.6.tar.gz

Download URL munchboka_edutools-0.10.6.tar.gz
Size 44.4 MB
Tags Source
SHA-256 checksum
How to use checksums
e0671a453b3620042dd6b13cd2fe88040b9ba97e37d1c2f40e0f62ddfe58707e
BLAKE2b-256 checksum
How to use checksums
950a1d283c7b266913921bdabe8b69bd036fd57c1496941c0a3e2e9f7c81169a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Release files / munchboka_edutools-0.10.6-py3-none-any.whl

Download URL munchboka_edutools-0.10.6-py3-none-any.whl
Size 3.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
5efb17c5d577126c9fba4f7441a5c7c09eb7ce5d42ac99e1809c947378ee1a7b
BLAKE2b-256 checksum
How to use checksums
98c93d27b6718ad2a0da6ff6ff6e652c2b75f1d4ed74de55c1e42949f7e09aa3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Security for munchboka-edutools 0.10.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10.6 This release

2 release files No provenance

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