Path Resolution Rules
Keep paths predictable and portable by using placeholders and letting BPM resolve them.
Base Directory
- Project mode: base is
ctx.project_dir(fromproject.yaml:project_path). - Ad‑hoc mode: base is
--out(no project changes; writesbpm.meta.yaml).
All renders go to: target = base / render.into after placeholder expansion, then normalized to an absolute path.
Placeholders in render.into
- Use
${ctx.project.name},${ctx.template.id}and otherctx.*values. - Default pattern (if omitted):
${ctx.project.name}/${ctx.template.id}/. - Examples:
${ctx.project.name}/${ctx.template.id}/→250903_TEST/hello/results/${ctx.template.id}→results/hello
Examples (project mode)
Assume project_path=/abs/250903_TEST, name=250903_TEST, and template id hello.
render.into: "${ctx.project.name}/${ctx.template.id}/"- Resolves to
/abs/250903_TEST/250903_TEST/hello/
- Resolves to
render.into: "results/${ctx.template.id}"- Resolves to
/abs/250903_TEST/results/hello
- Resolves to
render.into: "."- Resolves to
/abs/250903_TEST
- Resolves to
Ad‑hoc mode (--out /tmp/out): treat paths relative to /tmp/out unless you use an absolute path.
Relative vs Absolute
- Prefer relative
render.intopaths so templates work everywhere. - Absolute paths (e.g.,
/scratch/run1) are respected but reduce portability. - Avoid
..segments; BPM resolves the path, but leaving the project/out directory is discouraged.
Cross‑platform Tips
- Use forward slashes in templates; Python normalizes them on Windows/Unix.
- Don’t hard‑code drive letters or home shortcuts; prefer placeholders and relative paths.
Run Working Directory
bpm template runchanges into the resolvedrender.intodirectory and executesrun.entrythere.- Inside scripts, prefer relative paths to the working directory, or use `` for absolute project references.
Quick Checklist
- Keep
render.intorelative; rely on placeholders. - Include
${ctx.template.id}to avoid collisions between templates. - Use stable, filesystem‑safe names (see Naming & IDs).
- In ad‑hoc mode, pass
--outinstead of embedding absolute locations.