Lightweight data-plus-attributes node containers, with an optional lazily-loaded variant for out-of-core data.
Project description
Data Node
The node value type for a hierarchical data model — a single DataNode that
composes optional array data, structural identity, and layered metadata.
Overview
vcti-datanode provides DataNode, the payload for a tree whose nodes carry
heavy array data, metadata, both, or neither. A node composes three
independent, optional parts rather than splitting into a subclass per
combination:
- a
DataSource— how the node's array is obtained and how long it stays resident.EagerDataSourcewraps an array already in hand;LazyDataSourceproduces one on demand via a callable (read a file, compute a derived array, query a service) and can be released and re-loaded. A node with no data has no data source. intrinsicattributes — the node's structural identity (name,shape,dtype, …), kept in their own namespace so they never collide with free-form metadata.- metadata in two provenance layers —
source_attributes(immutable, as received) andenriched_attributes(mutable, added later), merged for reading asattributes.
It is built for CAE-style models read from a file (or built in memory), transformed, and exported — but depends on nothing beyond numpy and works anywhere a data-plus-metadata node is useful. See docs/design.md for the concepts and rationale.
Installation
pip install vcti-datanode
In requirements.txt
vcti-datanode>=2.0.0
In pyproject.toml dependencies
dependencies = [
"vcti-datanode>=2.0.0",
]
Quick Start
import numpy as np
from vcti.datanode import DataNode, EagerDataSource, LazyDataSource
# A metadata-only node (no data) — e.g. a grouping node.
group = DataNode(name="results", enriched_attributes={"analysis": "modal"})
# An eager node: the array is already in hand.
stress = DataNode(
name="stress",
data_source=EagerDataSource(np.array([1.0, 2.0, 3.0])),
source_attributes={"units": "MPa"},
)
stress.shape # (3,) — a derived intrinsic, read without touching data
stress.attributes["units"] # 'MPa'
# A lazy node: the array is fetched on demand and can be released.
disp = DataNode(
name="displacement",
data_source=LazyDataSource(lambda: np.load("disp.npy"), shape=(2, 3), dtype="float64"),
source_attributes={"units": "mm"},
)
disp.is_loaded # False — but disp.shape is already (2, 3)
arr = disp.load() # loader runs once; cached thereafter
disp.unload() # frees the array; metadata and intrinsics remain
Comparison is explicit (nodes compare by identity, not value):
from vcti.datanode import metadata_equal, data_equal, node_equal
metadata_equal(a, b) # intrinsic + metadata; never loads data
data_equal(a, b) # compares arrays, materialising if needed
node_equal(a, b) # both
Run the example end to end to see the package working:
python examples/basic_usage.py
Documentation
- Changelog — Release history and versioning policy
- Design — Concepts and the rationale behind the model
- Source Guide — File descriptions and execution flows
- Extension Guide — Writing a custom
DataSource - API Reference — Autodoc for all modules
examples/basic_usage.py— Runnable tour of the API
Dependencies
numpy>=1.26— array data, and structural facts (shape/dtype).
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_datanode-2.0.0.tar.gz.
File metadata
- Download URL: vcti_datanode-2.0.0.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0216b7981388e8e9b0514e73f6f6deca00a521d081a6aa8f83467503750cff6
|
|
| MD5 |
4c81052a44a717094c372dda728edb67
|
|
| BLAKE2b-256 |
6ac3853d79ef258fdbebd71adf6df54333c6487806a839b08501590d4f8a2470
|
Provenance
The following attestation bundles were made for vcti_datanode-2.0.0.tar.gz:
Publisher:
release.yml on vcollab/vcti-python-datanode
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_datanode-2.0.0.tar.gz -
Subject digest:
a0216b7981388e8e9b0514e73f6f6deca00a521d081a6aa8f83467503750cff6 - Sigstore transparency entry: 1973064250
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-datanode@041ec56ccf01475c28b4d2862fec8b1a54972834 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@041ec56ccf01475c28b4d2862fec8b1a54972834 -
Trigger Event:
push
-
Statement type:
File details
Details for the file vcti_datanode-2.0.0-py3-none-any.whl.
File metadata
- Download URL: vcti_datanode-2.0.0-py3-none-any.whl
- Upload date:
- Size: 12.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 |
6b50150b47036dc3ca0c47419c8a067e093efcbabdab1280bcea5c827f576a05
|
|
| MD5 |
e212e934506ba2eee474ed23f9100c5f
|
|
| BLAKE2b-256 |
cbee1449f02c40379b2cdb09d9a1f4cdff7086d607fb109e8ef724471e14d964
|
Provenance
The following attestation bundles were made for vcti_datanode-2.0.0-py3-none-any.whl:
Publisher:
release.yml on vcollab/vcti-python-datanode
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_datanode-2.0.0-py3-none-any.whl -
Subject digest:
6b50150b47036dc3ca0c47419c8a067e093efcbabdab1280bcea5c827f576a05 - Sigstore transparency entry: 1973064352
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-datanode@041ec56ccf01475c28b4d2862fec8b1a54972834 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@041ec56ccf01475c28b4d2862fec8b1a54972834 -
Trigger Event:
push
-
Statement type: