pipeio: Scaffolding Specification¶
Purpose¶
Scaffolding creates new flows and mods from templates, ensuring they follow the canonical directory structure and are properly integrated into the registry.
Flow Scaffolding (pipeio flow new)¶
Current State (pixecog)¶
The template lives at code/pipelines/_template/flow/ and is applied via cp -R + sed -i to replace __PIPE__ / __FLOW__ placeholders.
Template Structure¶
_template/flow/
├── Snakefile # workflow entry point with __PIPE__/__FLOW__ vars
├── config.yml # skeleton config with input/output dirs
├── Makefile # notebook lifecycle targets
├── scripts/
│ └── example_step.py # script template with mock snakemake object
├── notebooks/
│ ├── notebook.yml # empty notebook config
│ └── explore_registry_bootstrap/
│ └── explore_registry_bootstrap.py # bootstrap notebook
├── report/ # RST captions directory
└── _docs/
└── README.md # guidance on writing mod-level docs
pipeio Implementation¶
$ pipeio flow new preprocess ecephys
- Copy template — copy
_template/flow/to<pipelines_dir>/<pipe>/<flow>/ - Variable substitution — replace
__PIPE__→preprocess,__FLOW__→ecephysin all files (Jinja2 or simple string replacement) - Create output directory —
mkdir -p derivatives/<pipe>/ - Update registry — add the new flow entry to
.pipeio/registry.yml - Create docs stubs — scaffold
docs/explanation/pipelines/pipe-<pipe>/flow-<flow>/index.md - Post-scaffold report — print what was created and next steps
Options¶
pipeio flow new <pipe> <flow> [OPTIONS]
Options:
--template PATH Custom template directory (default: built-in)
--pipelines-dir PATH Override pipelines directory
--no-registry Skip registry update
--no-docs Skip docs stub creation
--dry Show what would be created without creating it
Template Variables¶
| Variable | Replacement |
|---|---|
__PIPE__ |
Pipe name (e.g., preprocess) |
__FLOW__ |
Flow name (e.g., ecephys) |
__PIPE_FLOW_ID__ |
pipe-<pipe>_flow-<flow> |
__DATE__ |
Current date (ISO format) |
Validation¶
Before scaffolding:
- Target directory must not already exist
- Pipe name and flow name must pass
slug_ok()validation - Template directory must exist and contain at least
Snakefileorconfig.yml
Mod Scaffolding (Future)¶
$ pipeio mod new preprocess/ieeg atlas
Creates:
scripts/atlas.py— script template with rule prefixatlas__docs/mod-atlas/— mod documentation stub (Theory/Spec/Delta)- Updates
registry.ymlwith the new mod entry
Built-in Templates¶
pipeio ships with a minimal built-in template (pipeio/templates/flow/) covering:
Snakefile— minimal Snakemake workflow skeletonconfig.yml— input/output/registry skeletonnotebooks/notebook.yml— empty notebook configscripts/example_step.py— script template
Projects can override with their own templates via --template or by placing templates at .pipeio/templates/flow/.