forked from genewildish/Mainline
- params.py: border field now accepts bool | BorderMode - presets.py: add UI_PRESET with BorderMode.UI, remove SIXEL_PRESET - __init__.py: export UI_PRESET, drop SIXEL_PRESET - registry.py: auto-register FrameBufferStage on discovery - New FrameBufferStage for frame history and intensity maps - Tests: update test_pipeline for UI preset, add test_framebuffer_stage.py This sets the foundation for interactive UI panel and modern pipeline composition.
107 lines
2.6 KiB
Python
107 lines
2.6 KiB
Python
"""
|
|
Unified Pipeline Architecture.
|
|
|
|
This module provides a clean, dependency-managed pipeline system:
|
|
- Stage: Base class for all pipeline components
|
|
- Pipeline: DAG-based execution orchestrator
|
|
- PipelineParams: Runtime configuration for animation
|
|
- PipelinePreset: Pre-configured pipeline configurations
|
|
- StageRegistry: Unified registration for all stage types
|
|
|
|
The pipeline architecture supports:
|
|
- Sources: Data providers (headlines, poetry, pipeline viz)
|
|
- Effects: Post-processors (noise, fade, glitch, hud)
|
|
- Displays: Output backends (terminal, pygame, websocket)
|
|
- Cameras: Viewport controllers (vertical, horizontal, omni)
|
|
|
|
Example:
|
|
from engine.pipeline import Pipeline, PipelineConfig, StageRegistry
|
|
|
|
pipeline = Pipeline(PipelineConfig(source="headlines", display="terminal"))
|
|
pipeline.add_stage("source", StageRegistry.create("source", "headlines"))
|
|
pipeline.add_stage("display", StageRegistry.create("display", "terminal"))
|
|
pipeline.build().initialize()
|
|
|
|
result = pipeline.execute(initial_data)
|
|
"""
|
|
|
|
from engine.pipeline.controller import (
|
|
Pipeline,
|
|
PipelineConfig,
|
|
PipelineRunner,
|
|
create_default_pipeline,
|
|
create_pipeline_from_params,
|
|
)
|
|
from engine.pipeline.core import (
|
|
PipelineContext,
|
|
Stage,
|
|
StageConfig,
|
|
StageError,
|
|
StageResult,
|
|
)
|
|
from engine.pipeline.params import (
|
|
DEFAULT_HEADLINE_PARAMS,
|
|
DEFAULT_PIPELINE_PARAMS,
|
|
DEFAULT_PYGAME_PARAMS,
|
|
PipelineParams,
|
|
)
|
|
from engine.pipeline.presets import (
|
|
DEMO_PRESET,
|
|
FIREHOSE_PRESET,
|
|
PIPELINE_VIZ_PRESET,
|
|
POETRY_PRESET,
|
|
UI_PRESET,
|
|
WEBSOCKET_PRESET,
|
|
PipelinePreset,
|
|
create_preset_from_params,
|
|
get_preset,
|
|
list_presets,
|
|
)
|
|
from engine.pipeline.registry import (
|
|
StageRegistry,
|
|
discover_stages,
|
|
register_camera,
|
|
register_display,
|
|
register_effect,
|
|
register_source,
|
|
)
|
|
|
|
__all__ = [
|
|
# Core
|
|
"Stage",
|
|
"StageConfig",
|
|
"StageError",
|
|
"StageResult",
|
|
"PipelineContext",
|
|
# Controller
|
|
"Pipeline",
|
|
"PipelineConfig",
|
|
"PipelineRunner",
|
|
"create_default_pipeline",
|
|
"create_pipeline_from_params",
|
|
# Params
|
|
"PipelineParams",
|
|
"DEFAULT_HEADLINE_PARAMS",
|
|
"DEFAULT_PIPELINE_PARAMS",
|
|
"DEFAULT_PYGAME_PARAMS",
|
|
# Presets
|
|
"PipelinePreset",
|
|
"PRESETS",
|
|
"DEMO_PRESET",
|
|
"POETRY_PRESET",
|
|
"PIPELINE_VIZ_PRESET",
|
|
"WEBSOCKET_PRESET",
|
|
"FIREHOSE_PRESET",
|
|
"UI_PRESET",
|
|
"get_preset",
|
|
"list_presets",
|
|
"create_preset_from_params",
|
|
# Registry
|
|
"StageRegistry",
|
|
"discover_stages",
|
|
"register_source",
|
|
"register_effect",
|
|
"register_display",
|
|
"register_camera",
|
|
]
|