partitor
How it works

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.

The parts of a runYour terminalLinux hostSandbox: no network, read-onlyYour file managerLibrary folder: local, or an SMB sharesystemd-runreadswritesPDFs in, parts outTerminal or SSHbin/partitor: rootwrapper, never reads a PDFlib/partitor-engine:launcherlib/partitor: the enginepackageFile manager, SFTP or NASappinbox: score PDFslibrary: one folder perpiece, with proof andparts
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.

From score to partsproofgo back1 Drop: PDF in the inbox2 Analyse: read every page3 Edit: names, choices,layout4 Review: proof andsettings5 Build: one PDF per part
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.

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.

The modulesLevel 9Level 8Level 7Level 6Level 5Level 4Level 3Level 2Level 1Level 0cli_maincli_itemscli_barscli_partscli_cuescli_commonbuildproofpartplanlibrarycueplaceanalysisrenderlinesownershipcuesstagecacheclefparallelreflowrunlogstripsturnplanvisionbarsconfigconsolemappingmodelhooksoutfiletypography
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.

Platformsinstalls its hooksinstalls its hookslib/partitor: the core, noOS checkslib/partitor/hooks.py:Linux defaultsplatforms/windows:replaces the hooksplatforms/browser:replaces the hooks, OCR inWebAssembly
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.