API Reference
Auto-generated reference documentation for the Flow3R public plugin API.
Plugin interface
flow3r.core.plugin.plugin.IPlugin
Bases: Protocol
Interface that every Flow3R plugin must satisfy.
A plugin is the single entry-point object that Flow3R instantiates when it
discovers a flow3r.plugins entry-point group. Its only responsibility
is to call the relevant api.*.register(...) methods during
:meth:initialize so that the application becomes aware of the source
types, pipeline types, visualizers, and settings the plugin provides.
Example package entry-point declaration (pyproject.toml)::
[project.entry-points."flow3r.plugins"]
my_plugin = "my_package.plugin:MyPlugin"
Source code in src/flow3r/core/plugin/plugin.py
name
property
Human-readable name of the plugin (used in log messages).
initialize(api)
Register all plugin contributions with the application.
Called exactly once, before the main window is shown. Use api to register source types, pipeline types, visualizers, config types, and settings menus.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api
|
IPluginAPI
|
The plugin API surface provided by the application. |
required |
Source code in src/flow3r/core/plugin/plugin.py
Plugin API
flow3r.core.api.plugins.plugins.IPluginAPI
Bases: Protocol
Read-only protocol describing the API surface available to plugins.
An instance of this protocol is passed to :meth:IPlugin.initialize for
every loaded plugin. Plugins use the registry properties to register their
contributions (source types, pipeline types, etc.) with the application.
The concrete implementation is :class:flow3r.app.api.plugins.plugins.PluginAPI.
Source code in src/flow3r/core/api/plugins/plugins.py
config_types
property
Registry for mapping TYPE_ID strings to config dataclasses.
Plugins must register a config class here for every source config and
pipeline config they introduce so that Flow3R can deserialise saved
.f3r project files correctly.
source_types
property
Registry for :class:~flow3r.core.source.abc.source_type.ISourceType objects.
Each registered source type appears in the Add Source dialog and can be instantiated by the user when building a recording project.
visualizer_types
property
Registry for visualizer types (live preview widgets).
pipeline_types
property
Registry for :class:~flow3r.core.pipeline.abc.pipeline_type.IPipelineType objects.
Each registered pipeline type appears in the Add Pipeline dialog and can be attached to a recording group.
settings
property
Registry for application-wide settings keys and their default values.
settings_menus
property
Registry for plugin-contributed entries in the Settings menu.
flow3r.app.api.plugins.plugins.PluginAPI
Bases: IPluginAPI
Source code in src/flow3r/app/api/plugins/plugins.py
Source types
flow3r.core.source.abc.source_type.ISourceType
Bases: Protocol[TConfig, TDesc, TData]
Protocol that describes a kind of source (e.g. "Webcam", "Pylon Camera").
Flow3R uses :class:ISourceType objects as factories. When a user adds a
source in the UI, the application calls the relevant factory callables to
create a default config, a config-editing widget, and ultimately a live
source instance.
Use the concrete :class:SourceType dataclass when registering a source type
from a plugin — it satisfies this protocol automatically.
Source code in src/flow3r/core/source/abc/source_type.py
name
property
Unique, human-readable name shown in the Add Source dialog (e.g. "Webcam").
category
property
Hierarchical category path used to group sources in menus (e.g. ("Video", "Camera")).
config_factory
property
Zero-argument callable that returns a default source config instance.
config_widget_factory
property
Callable (config, parent) -> IConfigWidget that creates the source config editor widget.
source_factory
property
Callable (config) -> ISource that constructs a live source instance.
flow3r.core.source.abc.source_type.SourceType
dataclass
Bases: Generic[TConfig, TDesc, TData]
Concrete dataclass implementation of :class:ISourceType.
Create one of these and pass it to
:meth:~flow3r.app.api.plugins.source_type_registry.SourceTypeRegistry.register
inside your plugin's :meth:~flow3r.core.plugin.plugin.IPlugin.initialize method.
Example::
MY_SOURCE_TYPE = SourceType(
name="My Camera",
category=("Video", "Camera"),
config_factory=MyCameraConfig,
config_widget_factory=MyCameraConfigWidget,
source_factory=MyCameraSource,
)
# inside IPlugin.initialize:
api.source_types.register(MY_SOURCE_TYPE)
Source code in src/flow3r/core/source/abc/source_type.py
name
instance-attribute
Unique, human-readable name shown in the Add Source dialog.
category
instance-attribute
Hierarchical category path (e.g. ("Video", "Camera")).
config_factory
instance-attribute
Zero-argument callable that returns a default source config instance.
config_widget_factory
instance-attribute
Callable (config, parent) -> IConfigWidget for the config editor widget.
source_factory
instance-attribute
Callable (config) -> ISource that constructs a live source instance.
flow3r.app.api.plugins.source_type_registry.SourceTypeRegistry
Bases: ISourceTypeRegistry
Concrete registry that maps source type names to :class:ISourceType objects.
Plugins call :meth:register inside :meth:~flow3r.core.plugin.plugin.IPlugin.initialize
to make their source types available in the Add Source dialog.
Source code in src/flow3r/app/api/plugins/source_type_registry.py
register(source_type)
Register a source type with the application.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_type
|
ISourceType
|
A fully configured :class: |
required |
Source code in src/flow3r/app/api/plugins/source_type_registry.py
Sources
flow3r.core.source.abc.source.ISource
Bases: Protocol[TDesc, TData]
Protocol for a single data source (camera, microphone, file, …).
A source encapsulates one device or file and exposes its data as a
reactive stream. The application calls :meth:open before subscribing
to the stream and :meth:close when the source is no longer needed.
Class Type Parameters:
| Name | Bound or Constraints | Description | Default |
|---|---|---|---|
TDesc
|
Descriptor type emitted by the stream (e.g. frame metadata). |
required | |
TData
|
Data type emitted by the stream (e.g. |
required |
Source code in src/flow3r/core/source/abc/source.py
stream
property
The reactive stream that emits items from this source.
open()
Pipeline types
flow3r.core.pipeline.abc.pipeline_type.IPipelineType
Bases: Protocol[TConfig, TPipeline]
Protocol that describes a kind of pipeline (e.g. "Record Video").
Flow3R uses :class:IPipelineType objects as factories. When a user adds a
pipeline to a group, the application calls the factory callables to create a
default config, a config-editing widget, and ultimately a pipeline instance.
Use the concrete :class:PipelineType dataclass when registering a pipeline
type from a plugin — it satisfies this protocol automatically.
Source code in src/flow3r/core/pipeline/abc/pipeline_type.py
name
property
Unique, human-readable name shown in the Add Pipeline dialog (e.g. "Record Video").
category
property
Hierarchical category path used to group pipelines in menus (e.g. ("Video",)).
config_factory
property
Zero-argument callable that returns a default pipeline config instance.
config_widget_factory
property
Callable (app_context, config, parent) -> IConfigWidget for the config editor widget.
pipeline_factory
property
Zero-argument callable that constructs a new pipeline instance.
flow3r.core.pipeline.abc.pipeline_type.PipelineType
dataclass
Bases: Generic[TConfig, TPipeline]
Concrete dataclass implementation of :class:IPipelineType.
Create one of these and pass it to
:meth:~flow3r.app.api.plugins.pipeline_type_registry.PipelineTypeRegistry.register
inside your plugin's :meth:~flow3r.core.plugin.plugin.IPlugin.initialize method.
Example::
MY_PIPELINE_TYPE = PipelineType(
name="My Analysis",
category=("Analysis",),
config_factory=MyAnalysisConfig,
config_widget_factory=MyAnalysisConfigWidget,
pipeline_factory=MyAnalysisPipeline,
)
# inside IPlugin.initialize:
api.pipeline_types.register(MY_PIPELINE_TYPE)
Source code in src/flow3r/core/pipeline/abc/pipeline_type.py
name
instance-attribute
Unique, human-readable name shown in the Add Pipeline dialog.
category
instance-attribute
Hierarchical category path (e.g. ("Video",)).
config_factory
instance-attribute
Zero-argument callable that returns a default pipeline config instance.
config_widget_factory
instance-attribute
Callable (app_context, config, parent) -> IConfigWidget for the config editor widget.
pipeline_factory
instance-attribute
Zero-argument callable that constructs a new pipeline instance.
flow3r.app.api.plugins.pipeline_type_registry.PipelineTypeRegistry
Bases: IPipelineTypeRegistry
Concrete registry that maps pipeline type names to :class:IPipelineType objects.
Plugins call :meth:register inside :meth:~flow3r.core.plugin.plugin.IPlugin.initialize
to make their pipeline types available in the Add Pipeline dialog.
Source code in src/flow3r/app/api/plugins/pipeline_type_registry.py
register(pipeline_type)
Register a pipeline type with the application.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pipeline_type
|
IPipelineType
|
A fully configured :class: |
required |
Source code in src/flow3r/app/api/plugins/pipeline_type_registry.py
Pipelines
flow3r.core.pipeline.abc.pipeline.PipelineContext
Bases: Generic[TConfig]
Passed to :meth:IPipeline.build for a recording run.
Carries the resolved config and services, and exposes registration methods
for wiring the full recording pipeline. Call :meth:register_primary_done
exactly once before build() returns. Optionally call
:meth:register_secondary_done for post-processing (e.g. muxing).
.. code-block:: python
def build(self, context: PipelineContext[MyConfig], sources):
sub = my_sink.subscribe(sources["Video"])
context.register_primary_done(sub.done)
context.add_disposable(sub.disposable)
Attributes:
| Name | Type | Description |
|---|---|---|
config |
The resolved pipeline config for this session. |
|
settings |
Read-only view of application settings. |
|
widget_service |
Service for obtaining visualizer widget handles. |
|
control |
Observable that emits |
Source code in src/flow3r/core/pipeline/abc/pipeline.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
register_primary_done(obs)
Register the observable that signals primary-work completion.
The observable should emit (or complete) once the core recording work
is done — e.g. the video file has been flushed and closed. Must be
called exactly once before build() returns.
Source code in src/flow3r/core/pipeline/abc/pipeline.py
register_secondary_done(obs)
Register the observable for secondary (post-processing) completion.
Optional. Use for follow-up steps (e.g. muxing) that happen after the primary recording files are closed.
Source code in src/flow3r/core/pipeline/abc/pipeline.py
register_progress(obs)
Register an observable that emits (completed, total) progress tuples.
Source code in src/flow3r/core/pipeline/abc/pipeline.py
add_disposable(disposable)
Add a disposable that will be disposed when the pipeline is aborted.
build_subscription()
Assemble a :class:PipelineSubscription from registered signals.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If :meth: |
Source code in src/flow3r/core/pipeline/abc/pipeline.py
flow3r.core.pipeline.abc.pipeline.IPipeline
Bases: Protocol[TConfig]
Protocol for a data processing pipeline attached to a recording group.
A pipeline receives streams from one or more sources and performs an operation on them (e.g. encoding video to disk, running pose estimation).
Lifecycle::
pipeline.configure(ConfigureContext(config, settings, widget_service))
pipeline.build(PipelineContext(config, settings, widget_service, control), sources)
# … recording runs …
pipeline.dispose()
Source code in src/flow3r/core/pipeline/abc/pipeline.py
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | |
supports_preview
property
Return True if this pipeline supports a live preview mode.
The framework checks this after :meth:configure is called, so the
value may depend on the current config (e.g. a checkbox that enables
an overlay). Set the backing field in :meth:configure:
.. code-block:: python
def configure(self, context):
self._supports_preview = context.config.show_overlay
@property
def supports_preview(self):
return self._supports_preview
Defaults to False — pipelines must explicitly opt in to preview.
supports_recording
property
Return True if this pipeline supports a recording (build) mode.
Defaults to True. Override to False for viewer-only pipelines
that only display live data and never write files.
configure(context)
Configure the pipeline for the upcoming session.
Called whenever the pipeline config changes and before every
:meth:build or :meth:preview call. Use this to stash per-session
state and pre-allocate resources such as ML models. Optional — the
default implementation is a no-op.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
ConfigureContext[TConfig]
|
Carries the resolved config, settings, and widget service. |
required |
Source code in src/flow3r/core/pipeline/abc/pipeline.py
preview(context, sources)
Start a live preview (non-recording) run.
Override to display a live feed or analysis result without writing persistent data. Register the preview's lifecycle via context:
.. code-block:: python
def preview(self, context: PreviewContext[MyConfig], sources):
sub = my_sink.subscribe(sources["Video"])
context.register_done(sub.done)
context.add_disposable(sub.disposable)
The default implementation is a no-op that completes immediately.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
PreviewContext[TConfig]
|
Carries config, settings, widget service, and registration methods. |
required |
sources
|
Dict[str, IStream]
|
Mapping of source name → stream for all sources in the group. |
required |
Source code in src/flow3r/core/pipeline/abc/pipeline.py
build(context, sources)
Start the pipeline (recording or processing run).
Register completion signals via context rather than returning a value:
.. code-block:: python
def build(self, context: PipelineContext[MyConfig], sources):
sub = my_sink.subscribe(sources["Video"])
context.register_primary_done(sub.done)
context.add_disposable(sub.disposable)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
PipelineContext[TConfig]
|
Carries config, settings, widget service, |
required |
sources
|
Dict[str, IStream]
|
Mapping of source name → stream for all sources in the group. |
required |
Source code in src/flow3r/core/pipeline/abc/pipeline.py
flow3r.core.pipeline.abc.pipeline.PipelineBase
Bases: IPipeline[TConfig], ABC
Convenient base class for pipeline implementations.
Provides no-op default implementations of all :class:IPipeline methods so
that subclasses only need to override the methods they care about.
Default capability flags: supports_preview = False,
supports_recording = True. Override either property (or set the
backing field in :meth:configure) to change per-instance.
Source code in src/flow3r/core/pipeline/abc/pipeline.py
flow3r.core.pipeline.iterative_pipeline.IterativePipeline
Bases: PipelineBase[TConfig], Generic[TConfig]
Base class for imperative, single-threaded pipeline implementations.
Override :meth:run to process frames one by one. The method receives
each source as a regular Python :class:~collections.abc.Iterable; just
iterate over it until it is exhausted (which happens automatically when
the recording stop is requested).
The default configure, preview, and dispose implementations
from :class:~flow3r.core.pipeline.abc.pipeline.PipelineBase are
inherited unchanged.
Source code in src/flow3r/core/pipeline/iterative_pipeline.py
run(sources)
Process frames until all source iterables are exhausted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sources
|
Dict[str, Iterable]
|
Mapping of input name → iterable of data items.
Each iterable yields items until the recording stop is
requested, then raises :class: |
required |
Source code in src/flow3r/core/pipeline/iterative_pipeline.py
flow3r.core.pipeline.abc.pipeline.PipelineSubscription
Returned internally by :meth:PipelineContext.build_subscription.
The framework uses this to track and dispose an active recording run.
Pipeline authors do not construct this directly — use the registration
methods on :class:PipelineContext instead.
Attributes:
| Name | Type | Description |
|---|---|---|
primary_done |
Observable that emits once the primary processing step completes. |
|
secondary_done |
Observable that emits once any secondary step completes. |
|
progress |
Observable of |
Source code in src/flow3r/core/pipeline/abc/pipeline.py
flow3r.core.pipeline.abc.pipeline.PreviewSubscription
Returned internally by :meth:PreviewContext.build_subscription.
The framework uses this to track and dispose an active preview.
Pipeline authors do not construct this directly — use
:meth:PreviewContext.register_done instead.
Source code in src/flow3r/core/pipeline/abc/pipeline.py
Config base classes
flow3r.core.config.abc.config.ConfigBase
dataclass
Bases: ABC, IConfig
Source code in src/flow3r/core/config/abc/config.py
flow3r.core.source.abc.source_config.SourceConfigBase
dataclass
flow3r.core.pipeline.abc.pipeline_config.PipelineConfigBase
dataclass
Bases: ConfigBase, IPipelineConfig, ABC