Architecture
How partitor is built and how a score becomes parts. The rules and algorithms are in
docs/DESIGN.md; this page is the map. It is checked against the code before every release.
Contributors: the diagrams follow the contract at the end of this page.
The parts of a run
partitor is a command-line program. It has no web interface, no server and no network access.
An experimental browser pack (platforms/browser/) runs the same engine inside a web browser, from
static files: there is still no server program, and the engine makes no network request.
On Linux you start the wrapper bin/partitor as root. The wrapper checks the paths and the
library folder and never reads a PDF. It starts the engine as the system user partitor, in a
sandbox (docs/SANDBOX.md). The engine reads score PDFs from the inbox folder of the library
and writes proofs and parts into the library folder.
Text version of this diagram
- Your terminal: Terminal or SSH.
- Linux host: bin/partitor: root wrapper, never reads a PDF.
- Sandbox: no network, read-only: lib/partitor-engine: launcher, lib/partitor: the engine package.
- Your file manager: File manager, SFTP or NAS app.
- Library folder: local, or an SMB share: inbox: score PDFs, library: one folder per piece, with proof and parts.
- Terminal or SSH to bin/partitor: root wrapper, never reads a PDF.
- bin/partitor: root wrapper, never reads a PDF to lib/partitor-engine: launcher (systemd-run).
- lib/partitor-engine: launcher to lib/partitor: the engine package.
- lib/partitor: the engine package to inbox: score PDFs (reads).
- lib/partitor: the engine package to library: one folder per piece, with proof and parts (writes).
- File manager, SFTP or NAS app and Library folder: local, or an SMB share (PDFs in, parts out).
The library layout is a stable contract (docs/LIBRARY-LAYOUT.md). Everything else in a piece
folder is internal.
From score to parts
Five stages. You can go back from Review to Edit as often as you like. Nothing is built until the last stage.
Text version of this diagram
- Boxes: 1 Drop: PDF in the inbox; 2 Analyse: read every page; 3 Edit: names, choices, layout; 4 Review: proof and settings; 5 Build: one PDF per part.
- 1 Drop: PDF in the inbox to 2 Analyse: read every page.
- 2 Analyse: read every page to 3 Edit: names, choices, layout (proof).
- 3 Edit: names, choices, layout to 4 Review: proof and settings.
- 4 Review: proof and settings to 3 Edit: names, choices, layout (go back).
- 4 Review: proof and settings to 5 Build: one PDF per part.
- Analyse. One raster pipeline reads vector and scanned pages alike: render, find staves and
systems, give every ink component one owner, read labels and bar numbers (
docs/DESIGN.md§4). Pages run in parallel workers, and a stage cache keeps the result of a page. - Edit and Review. Your answers are saved in the settings of the piece and nothing is built.
- Build. The saved lines are packed into pages. Page turns decide the page count
(
docs/DESIGN.md§5). Cues that you set are drawn above the long rests (docs/DESIGN.md§13). Each part also gets a large-print copy.
The modules
The engine is the package lib/partitor/. Each module has a level. A module imports only
from a strictly lower level, so there is no cycle. The block below comes from tools/modules.txt.
The list of what each module owns is in docs/DESIGN.md §12.1.
Text version of this diagram
- Level 9: cli_main.
- Level 8: cli_items.
- Level 7: cli_bars, cli_parts, cli_cues.
- Level 6: cli_common.
- Level 5: build, proof.
- Level 4: partplan, library.
- Level 3: cueplace, analysis, render.
- Level 2: lines, ownership, cues, stagecache.
- Level 1: clef, parallel, reflow, runlog, strips, turnplan, vision.
- Level 0: bars, config, console, mapping, model, hooks, outfile, typography.
Platforms
Linux is the primary system. The core in lib/partitor/ has no operating-system checks. The few
things that differ (free memory, the console, the Tesseract path or another OCR engine, the
default library folder) are hooks in lib/partitor/hooks.py with Linux defaults. A platform pack
replaces them (platforms/windows/, platforms/browser/). On Windows and macOS there is no
wrapper and no sandbox: the engine runs directly, so open only PDFs that you trust. The browser
pack runs the engine in WebAssembly, inside the browser's sandbox, with the WebAssembly Tesseract
as its OCR engine.
Text version of this diagram
- Boxes: lib/partitor: the core, no OS checks; lib/partitor/hooks.py: Linux defaults; platforms/windows: replaces the hooks; platforms/browser: replaces the hooks, OCR in WebAssembly.
- lib/partitor: the core, no OS checks to lib/partitor/hooks.py: Linux defaults.
- platforms/windows: replaces the hooks to lib/partitor/hooks.py: Linux defaults (installs its hooks), dotted.
- platforms/browser: replaces the hooks, OCR in WebAssembly to lib/partitor/hooks.py: Linux defaults (installs its hooks), dotted.
