chemigram.core.pipeline¶
chemigram.core.pipeline
¶
Render pipeline.
v1 has a single stage (:class:~chemigram.core.stages.darktable_cli.DarktableCliStage).
The :class:PipelineStage Protocol exists to keep the seam clean and make
testing trivial — fakes are easy. Multi-stage chaining is YAGNI until a
real second stage materializes (closes RFC-005 → ADR-052).
Per ADR-005, a single darktable-cli runs per configdir at a time.
Serialization is enforced inside :class:DarktableCliStage via
per-configdir threading locks; the pipeline-level orchestrator is
otherwise plain sequential.
Public API
- :class:
StageContext, :class:StageResult— frozen dataclasses - :class:
PipelineStage— Protocol - :class:
Pipeline— orchestrator (single-stage in v1) - :func:
render— convenience entry point
StageContext
dataclass
¶
StageContext(raw_path, xmp_path, output_path, configdir, width=1024, height=1024, high_quality=False)
Inputs available to every render stage.
StageResult
dataclass
¶
Outputs from a stage.
PipelineStage
¶
Bases: Protocol
A render-pipeline stage. v1 has one (:class:DarktableCliStage).
Implementations are self-contained: a stage does its work and
returns a :class:StageResult. Stages don't know about other stages.
Pipeline
¶
Orchestrates a sequence of render stages.
v1 has exactly one stage; multi-stage threading is YAGNI until a
real second stage materializes. When that happens, run gains
output-of-N → input-of-N+1 logic; today it's just a passthrough.
Source code in src/chemigram/core/pipeline.py
run
¶
Run all stages sequentially.
For v1 (single stage) this is just self.stages[0].run(context).
Source code in src/chemigram/core/pipeline.py
render
¶
render(raw_path, xmp_path, output_path, *, width=1024, height=1024, high_quality=False, configdir=None)
Convenience: build the v1 single-stage pipeline and run it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raw_path
|
Path
|
input raw file (NEF, ARW, RAF, etc.) |
required |
xmp_path
|
Path
|
synthesized XMP sidecar to apply |
required |
output_path
|
Path
|
where to write the rendered JPEG |
required |
width
|
int
|
max output width in pixels (default 1024) |
1024
|
height
|
int
|
max output height in pixels (default 1024) |
1024
|
high_quality
|
bool
|
|
False
|
configdir
|
Path | None
|
darktable configdir (per ADR-005, isolated per session).
Must be a pre-bootstrapped darktable configdir — a fresh empty
directory makes |
None
|
Returns:
| Type | Description |
|---|---|
StageResult
|
class: |