Skip to main content

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. EagerDataSource wraps an array already in hand; LazyDataSource produces 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.
  • intrinsic attributes — 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) and enriched_attributes (mutable, added later), merged for reading as attributes.

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


Dependencies

  • numpy>=1.26 — array data, and structural facts (shape/dtype).

Metadata

Release files for vcti-datanode 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vcti-datanode 2.0.0
File Size Uploaded
vcti_datanode-2.0.0.tar.gz 15.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vcti-datanode 2.0.0
File Interpreter ABI Platform
vcti_datanode-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.3 kB

Release files / vcti_datanode-2.0.0.tar.gz

Download URL vcti_datanode-2.0.0.tar.gz
Size 15.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a0216b7981388e8e9b0514e73f6f6deca00a521d081a6aa8f83467503750cff6
BLAKE2b-256 checksum
How to use checksums
6ac3853d79ef258fdbebd71adf6df54333c6487806a839b08501590d4f8a2470
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.

Transparency log

Release files / vcti_datanode-2.0.0-py3-none-any.whl

Download URL vcti_datanode-2.0.0-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b50150b47036dc3ca0c47419c8a067e093efcbabdab1280bcea5c827f576a05
BLAKE2b-256 checksum
How to use checksums
cbee1449f02c40379b2cdb09d9a1f4cdff7086d607fb109e8ef724471e14d964
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page