vcti-flow bindings for array data: a DataNode payload binding and a FieldSet table binding (sources, transformers, reducers, sinks).
Project description
Data Flow
vcti-flow bindings for array data: a DataNode payload binding and a FieldSet table binding — sources, transformers, reducers, and sinks.
Overview
vcti-flow is a payload-agnostic
framework for composing flow graphs — it never inspects the values flowing
through it. This package binds that framework to two concrete payloads so you
subclass ready-bound node kinds instead of writing Source[...] everywhere:
vcti.flow.data— the vcti-datanodeDataNodebinding: one array plus layered attributes behind a data source. Node kindsSource/Transformer/Reducer/Sink/Observer, plusfrom_array(eager) andArraySource(lazy) payload builders.vcti.flow.fieldset— the vcti-fieldsetFieldSetbinding: a table of named columns. This is where column and row reshaping lives — select / drop / rename / cast / compute, filter / sort / slice, and the N→1 combiners merge / concat. The nodes are thin wrappers over FieldSet's own copy-freeproject()/rows()builders.
Use the DataNode binding for single-array flows; use the FieldSet binding to
reshape multi-column tables. DataNodesSource / WriteDataNodes bridge between
them (a group of DataNodes ⇆ a FieldSet).
Installation
pip install vcti-dataflow
In pyproject.toml dependencies
dependencies = [
"vcti-dataflow>=3.0.0",
]
Quick Start — DataNode binding
import numpy as np
from vcti.flow.data import Source, Transformer, DataNode, from_array
# A source produces a DataNode
class Stress(Source):
def load(self) -> DataNode:
return from_array(np.array([1.0, 2.0, 3.0]), {"units": "MPa"})
# A transformer maps one DataNode to another
class Scale(Transformer):
def __init__(self, factor: float) -> None:
super().__init__()
self.factor = factor
def transform(self, record: DataNode) -> DataNode:
return from_array(record.load() * self.factor, record.attributes)
result = Scale(2.0).connect(Stress()).execute()
result.load() # array([2., 4., 6.])
result.attributes["units"] # "MPa"
Reach for the array only when you need it (record.load()); a leaf source can
hand back a LazyDataSource-backed node (or use ArraySource) to defer a heavy
read.
Quick Start — FieldSet binding (tables)
The vcti.flow.fieldset nodes carry a FieldSet (named columns) and reshape it.
Column ops (select / drop / rename / cast) share columns by reference —
no data copy; cast is a lazy per-column cast. Row ops fold to a single index.
import numpy as np
from vcti.datanode import DataNode, EagerDataSource
from vcti.flow.fieldset import (
DataNodesSource, SelectFields, RenameFields, CastFields, ComputeFields,
FilterRows, SortRows, MergeFields, ConcatRows, WriteDataNodes,
)
# Read a group of DataNodes as one FieldSet (lazy — nothing materialises here)
src = DataNodesSource([
DataNode(name="id", data_source=EagerDataSource(np.array([1, 2, 3]))),
DataNode(name="stress", data_source=EagerDataSource(np.array([10.0, 20.0, 30.0]))),
])
# Reshape: rename, add a computed column, filter and sort rows
flow = RenameFields({"stress": "s"}).connect(src)
flow = ComputeFields("s_kpa = s * 1000").connect(flow)
flow = FilterRows("s > 10").connect(flow)
flow = SortRows("s", descending=True).connect(flow)
result = flow.execute() # a FieldSet
result.get_values("s_kpa") # array([30000., 20000.])
# Combine tables — N→1 reducers own the policy (collision / schema)
wide = MergeFields().connect(flowA).connect(flowB) # union columns
tall = ConcatRows().connect(flowA).connect(flowB) # stack rows
# Write out: FieldSet -> DataNodes -> your writer (I/O stays in your app)
WriteDataNodes(lambda node: write_to_h5(node)).connect(flow).execute()
Column reshaping is project()-backed; row reshaping is rows()-backed. See
docs/patterns.md for the full recipe set.
API
vcti.flow.data — DataNode binding
| Symbol | Purpose |
|---|---|
Source / Transformer / Reducer / Sink / Observer |
vcti.flow kinds bound to DataNode |
from_array(array, attributes=None) |
Build a DataNode from an in-memory array (eager) |
ArraySource(load_fn, attributes=None) |
Lazy leaf source over a callable returning an array |
DataNode / EagerDataSource / LazyDataSource |
Re-exported from vcti-datanode |
vcti.flow.fieldset — FieldSet binding
| Symbol | Purpose |
|---|---|
Source / Transformer / Reducer / Sink / Observer |
vcti.flow kinds bound to FieldSet |
SelectFields / DropFields / RenameFields |
Keep / remove / rename columns (share sources, no copy) |
CastFields / ComputeFields / FreezeFields |
Cast dtypes (lazy), add expression columns, bake an expression to data |
FilterRows / SortRows / HeadRows / SliceRows |
Row selection (fold to one index; slice stays a view) |
MergeFields / ConcatRows |
N→1: union columns / stack rows (own collision & schema policy) |
FieldSetSource |
Leaf source over an existing FieldSet (or a callable returning one) |
DataNodesSource / WriteDataNodes |
Boundary: DataNodes → FieldSet / FieldSet → DataNodes |
for_each_group(source, key_field, factory) |
Fan out into one flow per group |
from_datanodes / to_datanodes |
Re-exported from vcti-fieldset |
Dependencies
- vcti-flow (>=2.0.0) — the generic framework
- vcti-datanode (>=2.0.0) — the
DataNodepayload - vcti-fieldset
[datanode](>=2.0.0) — theFieldSettable payload and its copy-free reshaping - numpy (>=1.24)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vcti_dataflow-3.0.0.tar.gz.
File metadata
- Download URL: vcti_dataflow-3.0.0.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04cceb1d7bfe3e23d1b2e5d9b5050abe8d863970b1c3ef81b1c30d8544bcadac
|
|
| MD5 |
b0bf16ab269a7ac66d740c9fb151e4bc
|
|
| BLAKE2b-256 |
3481b571003b0a4cfca84e592fcb16e0c2dd357dde73bc8a59318356378f8f24
|
Provenance
The following attestation bundles were made for vcti_dataflow-3.0.0.tar.gz:
Publisher:
release.yml on vcollab/vcti-python-dataflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_dataflow-3.0.0.tar.gz -
Subject digest:
04cceb1d7bfe3e23d1b2e5d9b5050abe8d863970b1c3ef81b1c30d8544bcadac - Sigstore transparency entry: 2072338989
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-dataflow@c9830534eca69ec334909cfb50aec7d591024765 -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c9830534eca69ec334909cfb50aec7d591024765 -
Trigger Event:
push
-
Statement type:
File details
Details for the file vcti_dataflow-3.0.0-py3-none-any.whl.
File metadata
- Download URL: vcti_dataflow-3.0.0-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ac7500c7da4aee72978e09a6ad4ef34a5c0ac2f34a19f1d789b394bcb561a88
|
|
| MD5 |
3998cc5de57ca44f02758e75aa433052
|
|
| BLAKE2b-256 |
b1e644c3d0c9d70d8097b6c7128ab06ce7a48c53206d133ecc0b7a8ac7935b92
|
Provenance
The following attestation bundles were made for vcti_dataflow-3.0.0-py3-none-any.whl:
Publisher:
release.yml on vcollab/vcti-python-dataflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_dataflow-3.0.0-py3-none-any.whl -
Subject digest:
7ac7500c7da4aee72978e09a6ad4ef34a5c0ac2f34a19f1d789b394bcb561a88 - Sigstore transparency entry: 2072339035
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-dataflow@c9830534eca69ec334909cfb50aec7d591024765 -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c9830534eca69ec334909cfb50aec7d591024765 -
Trigger Event:
push
-
Statement type: