How Fignimble works¶
Fignimble is a Python engine and a macOS app that talk JSON lines over standard input and output. The design comes from Manimble: the engine and app split, the protocol, the undo that coexists with an agent's edits, the terminal drawer and the agent instruction files.
engine/fignimble/ api.py the figure language (Figure, Style, Labels, Panel, layouts, cached)
layout.py patchwork-style layouts: rows, columns, grids and designs as grids of tracks
render.py runs figure and panel code, lines up plot areas, collects legends, composes with
PyMuPDF, sprites, preflight, export, dark versions
srcedit.py canvas edits -> minimal source patches through Python's syntax tree
core.py the session: render worker, edit operations, undo, watching the project
rpc.py JSON lines over stdio for the app (see the engine protocol)
requirements.py packages Fignimble and a project need, and installing them
cli.py the fignimble command
apps/macos/ the macOS app (Swift, AppKit, SwiftTerm)
examples/demo/ a project to try
tests/ engine tests
Rendering¶
A long-lived worker process runs the figure file, which records its elements, then draws each panel with matplotlib
at its size into a PDF, measures its plot area and texts, and draws again panels whose plot areas should line up.
PyMuPDF composes the pieces into the figure. Every piece is cached in the project's .fignimble/ under a hash of
what it depends on: its code, the style, its size, and the project's other files.
Editing¶
A canvas edit (move, resize, retype, recolor) becomes an operation that srcedit.py turns into the smallest change
to the source: it finds the call through Python's syntax tree and rewrites one argument. Each edit is one undo step
holding the files' contents before and after; undo merges line by line, so lines changed since by an agent or another
editor are left alone.
Building and testing¶
python3 -m venv .venv && .venv/bin/pip install -r engine/requirements.txt pytest
apps/macos/build_app.sh # the app finds the checkout's .venv
PYTHONPATH=engine .venv/bin/python -m pytest tests
Running the app with FIGNIMBLE_SHOTS=<folder> walks through the editor on a project (give it a copy) and saves
pictures of the window. FIGNIMBLE_SHOTS_SCENE=audit checks Select All, Copy, Cut, Paste, Undo and Delete in every
place you type, writing audit PASS and audit FAIL lines to ~/Library/Logs/fignimble.log.
Releases are built, signed and notarized by GitHub Actions when a v* tag is pushed.