Core API¶
The aptdata.core package exposes the two-layer contract system for all
four foundational types.
Dataset¶
IDataset¶
aptdata.core.dataset.IDataset
dataclass
¶
Bases: ABC, Generic[T]
Dataclass interface for dataset types.
All dataset contracts must implement :meth:read and :meth:write.
No concrete fields are defined here – field declarations live in
:class:BaseDataset and its subclasses.
Source code in aptdata/core/dataset.py
BaseDataset¶
aptdata.core.dataset.BaseDataset
dataclass
¶
Bases: IDataset[Any]
Base dataset with Pydantic-validated fields.
Provides the canonical uri and schema_metadata fields.
Concrete dataset implementations must inherit from this class and
implement the :meth:read and :meth:write abstract methods
inherited from :class:IDataset.
Source code in aptdata/core/dataset.py
Component¶
ComponentKind¶
aptdata.core.system.ComponentKind
¶
Bases: str, Enum
Supported processing paradigms for a :class:BaseComponent.
Source code in aptdata/core/system.py
ComponentMeta¶
aptdata.core.system.ComponentMeta
dataclass
¶
Rich metadata describing a component's role and branching behaviour.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
ComponentKind
|
The processing paradigm this component belongs to. |
tags |
list[str]
|
Arbitrary string labels for filtering, grouping, or discovery. |
branch_on |
str
|
When non-empty, names the output field or condition key on which the flow should branch after this component executes. |
description |
str
|
Human-readable summary of what this component does. |
extra |
dict[str, Any]
|
Open-ended mapping for framework extensions or user-defined metadata. |
Source code in aptdata/core/system.py
IComponent¶
aptdata.core.system.IComponent
dataclass
¶
Bases: ABC
Interface for a reusable unit of work.
A component receives a list of :class:~aptdata.core.dataset.IDataset
inputs, validates them, executes its logic, and returns a list of
:class:~aptdata.core.dataset.IDataset outputs. Unlike the legacy
IStep, it may produce multiple output datasets to support branching
flows.
Source code in aptdata/core/system.py
BaseComponent¶
aptdata.core.system.BaseComponent
dataclass
¶
Bases: IComponent
Base component with Pydantic-validated identity, metadata, and event hooks.
Concrete component implementations must inherit from this class and
implement the :meth:validate_inputs and :meth:execute abstract
methods inherited from :class:IComponent.
Automatically emits pre_execute, on_success, on_failure, and
post_execute events to the IContext event bus during execute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component_id |
A unique identifier for this component within a flow. |
required | |
metadata |
A :class: |
required |
Source code in aptdata/core/system.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 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 | |
Functions¶
__init_subclass__(**kwargs)
¶
Wrap subclass execute implementations with telemetry spans.
Source code in aptdata/core/system.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 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 | |
Flow¶
FlowEdge¶
aptdata.core.system.FlowEdge
¶
A directed edge in a :class:BaseFlow execution graph.
Optionally carries a condition callable; when present the edge is only
traversed when condition(outputs) evaluates to True, enabling
conditional / branching flows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_id |
The :attr: |
required | |
target_id |
The :attr: |
required | |
condition |
Optional predicate evaluated against the source component's outputs. |
required |
Source code in aptdata/core/system.py
FlowNode¶
aptdata.core.system.FlowNode
dataclass
¶
A node wrapping a :class:IComponent inside a :class:IFlow graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component |
IComponent
|
The component held by this node. |
required |
flow |
IFlow | None
|
Back-reference to the owning flow (set by the flow on insertion). |
None
|
Source code in aptdata/core/system.py
IFlow¶
aptdata.core.system.IFlow
dataclass
¶
Bases: ABC
Interface for a directed execution graph of :class:IComponent nodes.
A flow owns a set of components and the directed edges that connect them.
It is responsible for validating the graph structure (:meth:compile)
and driving execution (:meth:run).
Source code in aptdata/core/system.py
Attributes¶
context: IContext | None
abstractmethod
property
writable
¶
The execution context injected by the orchestrator.
Functions¶
build()
abstractmethod
¶
add_component(component, output_contract=None)
abstractmethod
¶
Add component as a node in this flow. Can be a class or instance. If a class is provided, the flow handles instantiation and validates outputs against output_contract.
Source code in aptdata/core/system.py
connect(source_id, target_id, condition=None)
abstractmethod
¶
Create a directed edge from source_id to target_id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_id |
str
|
The :attr: |
required |
target_id |
str
|
The :attr: |
required |
condition |
Callable[[list[IDataset]], bool] | None
|
Optional predicate that gates traversal of the edge. |
None
|
Source code in aptdata/core/system.py
compile()
abstractmethod
¶
Validate the graph structure before execution.
Implementations should raise :exc:ValueError when the graph is
invalid (e.g. unknown node references, cycles in a DAG-only flow).
run(initial_inputs)
abstractmethod
¶
Execute the flow starting with initial_inputs.
Returns the outputs produced by the terminal component(s).
BaseFlow¶
aptdata.core.system.BaseFlow
dataclass
¶
Bases: IFlow
Base flow with Pydantic-validated identity and a managed graph.
Concrete flow implementations must inherit from this class and implement
the :meth:add_component, :meth:connect, :meth:compile and
:meth:run abstract methods inherited from :class:IFlow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flow_id |
A unique identifier for this flow within a system. |
required |
Source code in aptdata/core/system.py
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 | |
System¶
ISystem¶
aptdata.core.system.ISystem
dataclass
¶
Bases: ABC
Interface for a system that orchestrates one or more :class:IFlow instances.
Source code in aptdata/core/system.py
BaseSystem¶
aptdata.core.system.BaseSystem
dataclass
¶
Bases: ISystem
Base system with Pydantic-validated identity and Event Bus manager.
Concrete system implementations must inherit from this class and implement
the :meth:register_flow and :meth:run abstract methods inherited from
:class:ISystem.
Instantiates a global EventBus on __post_init__ and manages the lifecycle
for decoupled observability and governance logic.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system_id |
A unique identifier for this system. |
required |
Source code in aptdata/core/system.py
Quick-import¶
All names are re-exported from the top-level aptdata.core package: