Monorepos

Last updated on May 21, 2026

A TofuPilot project holds one procedure or many, so a monorepo is the right layout when you want to share instrument drivers, calibration sequences, and finalizer phases across procedures. The patterns below scale from a single procedure on a laptop up to a fleet of related products that ship from the same repo.

Single procedure

When a project covers a single procedure, everything lives next to one procedure.yaml. Phases, plugs, environment, and locally-generated reports all sit in the same folder so you do not have to think about paths.

.env.local
procedure.yaml
test_cell_voltage.py
measure_capacity.py
Keysight34461A.py
ArbinBatteryTester.py

The TofuPilot Framework creates reports/ automatically to store Run results and Attachments, so you should never edit that folder by hand.

Multiple procedures

When a second product joins the repo, lift the reusable code into shared/ and keep each procedure under procedures/<name>/ with its own procedure.yaml. Each procedure then references shared code by relative path, so you keep one canonical copy of every driver and helper.

.env.local
procedure.yaml

Each procedure.yaml resolves Python references against its own directory, so shared modules are reached either via relative paths (../../shared/phases/save_to_mes) or by adding shared/ to PYTHONPATH from .env.local.

Sharing a plug across procedures

Define each plug once under shared/plugs/ and reference it from every procedure.yaml that needs it, so a single file holds the canonical driver.

procedures/laptop-battery-functional/procedure.yaml
plugs:
  - name: Power Supply
    python: ../../shared/plugs/RigolDP832:RigolDP832

When the driver changes, every procedure picks up the new version on the next run, so you do not have to remember to bump versions across the repo.

Sharing a phase group

When a calibration, safety-check group, or MES-upload finalizer runs the same way across procedures, lift it into a shared YAML group and pull it in with include. The included file declares its own phases, measurements, and plugs, and the including procedure sees the group as if it were inline.

procedures/laptop-battery-functional/procedure.yaml
setup:
  - name: Calibrate DMM
    include: ../../shared/phases/instrument_calibration/instrument_calibration.yaml

How is this guide?

On this page