Notebook-Based Extension Development
Mantis notebooks can be used as a lightweight development environment for extension panels and vertical panels. The goal is fast iteration: write Python setup code, write a TSX UI cell, run it in the notebook, then export the working vertical as a .mantisx package when it is ready to share or install.
This is especially useful for quick testing and prototyping. A notebook lets you try an idea against real Mantis data before deciding whether it should become a more formal extension package.
Philosophy
Use notebooks when you want to move quickly:
- prototype a new vertical panel
- test panel UI behavior before creating a full extension project
- combine Python analysis code with a small React UI
- experiment with callbacks, selection, bags, maps, and backend behavior
- package a working prototype as a reusable Mantis extension
Use a hand-built extension project when the panel is stable, needs a larger frontend build setup, has multiple panels, or needs a long-lived extension host with commands and activation events.
Notebook Vertical Shape
A notebook can become a vertical extension when it has:
- exactly one UI/TSX cell
- any number of Python cells marked as vertical cells
Python vertical cells become the extension backend setup. The UI/TSX cell becomes the panel UI. When exported or published, Mantis compiles the UI cell to JavaScript and packages it with a generated extension manifest.
Exporting To .mantisx
From the notebook UI, use Export Vertical as .mantisx.
The exported package contains the same extension bundle shape used by normal extensions:
my-vertical.mantisx
mantis.extension.json
dist/
panel.js
backend/
main.py
notebook/
vertical.jsonnotebook/vertical.json is Mantis notebook source metadata. It allows notebook-created verticals to round-trip back into the notebook editor later.
Importing From .mantisx Or Zip
From the notebook UI, use Import Vertical Bundle and select a .mantisx or .zip file.
If the package was exported from a Mantis notebook vertical, Mantis recreates the original editable notebook cells.
If the package is a classical extension without notebook source metadata, Mantis imports it as a preview notebook instead. Backend files become Python cells, and the UI cell previews the extension panel. This is useful for inspection and quick testing, but it is not the same as recovering the original source code from compiled JavaScript.
Practical Workflow
- Start in a notebook.
- Mark Python setup or callback cells as vertical cells.
- Add one UI/TSX cell for the panel.
- Run and iterate until the panel works.
- Export the vertical as
.mantisx. - Import the
.mantisxelsewhere, or install it as a Mantis extension.
This keeps notebooks as the fast path for experimentation while preserving the extension system as the packaging and distribution path.