Skip to main content

Tree Exporter

Format-agnostic exporters for vcti trees: an Exporter protocol and a plugin catalog, with per-format writers as plugins.

vcti-tree-exporter defines what an exporter is and how to catalogue and look one up. It implements no file format itself — concrete writers (HDF5, JSON, CSV, NumPy, …) live in separate plugin packages and are registered by the consumer. The thing being exported is any vcti-tree tree whose node payloads are vcti-datanode DataNodes (data + attributes), so one tree can be written to any registered format without the producer knowing about serialization.

Cataloguing and lookup are built on vcti-plugin-catalog (Descriptor + Registry).

Installation

pip install vcti-tree-exporter

The base package is intentionally small. Install a format plugin for each format you need:

pip install vcti-tree-exporter-hdf5    # single .h5 file
pip install vcti-tree-exporter-json    # single .json document
pip install vcti-tree-exporter-npz     # single .npz archive
pip install vcti-tree-exporter-csv     # directory tree of CSV tables

Core concepts

Piece Role
Exporter Structural protocol — a single export(tree, path, *, overwrite=False) method. Pure behavior; format name and extension are not on the exporter.
ExporterDescriptor A vcti-plugin-catalog Descriptor[Exporter]: the exporter is its instance; format, extension, and any other metadata are filterable attributes.
get_exporter_descriptor() Factory each plugin package provides, returning its ExporterDescriptor.
build_registry(descriptors) Build a plugin-catalog Registry from those descriptors.
get_exporter(registry, id) Resolve an exporter instance by descriptor id.

Quick Start

Register the descriptors your application uses, then resolve one and write a tree:

from pathlib import Path
from vcti.tree.exporter.core import build_registry, get_exporter
from vcti.tree.exporter.hdf5 import get_exporter_descriptor as hdf5_descriptor
from vcti.tree.exporter.json import get_exporter_descriptor as json_descriptor

registry = build_registry([hdf5_descriptor(), json_descriptor()])
get_exporter(registry, "hdf5").export(tree, Path("model.h5"), overwrite=True)

registry is an ordinary vcti.plugincatalog.Registry, so the general way to select an exporter is to filter by attributes, then use the matching id — the same pattern as the rest of the ecosystem:

from vcti.lookup import Rule
from vcti.tree.exporter.core import EXTENSION_ATTR

(desc,) = registry.lookup.filter([Rule(EXTENSION_ATTR, "==", ".h5")])
desc.exporter.export(tree, Path("model.h5"))

Exporter ids are a small, fixed, well-known set, so using get_exporter(registry, "hdf5") directly is also fine.

Writing a format plugin

A plugin's exporter only has to satisfy the protocol — one export method, no base class — and ship a get_exporter_descriptor() factory carrying its metadata:

from pathlib import Path
from vcti.tree.exporter.core import EXTENSION_ATTR, FORMAT_ATTR, ExporterDescriptor

class JsonExporter:
    def export(self, tree, path: Path, *, overwrite: bool = False) -> None:
        ...   # walk the tree (node.name, node.attributes, node.load()), write JSON

def get_exporter_descriptor() -> ExporterDescriptor:
    return ExporterDescriptor(
        id="json", name="JSON Exporter", exporter=JsonExporter(),
        attributes={FORMAT_ATTR: "json", EXTENSION_ATTR: ".json"},
    )

Ship it in its own package (with its own format dependencies, e.g. h5py for HDF5). The consuming application decides which descriptors to register — there is no implicit global discovery.

Dependencies

(No heavy/runtime format dependencies live here — those belong to the per-format plugin packages.)

Metadata

Release files for vcti-tree-exporter 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-tree-exporter 2.0.0
File Size Uploaded
vcti_tree_exporter-2.0.0.tar.gz 9.5 kB Details

Built distribution (wheel)

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

Total release size: 18.2 kB

Release files / vcti_tree_exporter-2.0.0.tar.gz

Download URL vcti_tree_exporter-2.0.0.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
27bc88eac7cc2f485ffd92eb00c74197ee8466efd8a26a6386012d84612221b9
BLAKE2b-256 checksum
How to use checksums
5133b0135d2ab5bb23de03bc5d907ce220d14a9da053e8d36a368f5472080ca5
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 27, 2026.

Transparency log

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

Download URL vcti_tree_exporter-2.0.0-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61f04498329fb6d48876160d3916de822cfaa0214fac28f2733462c44c7f2845
BLAKE2b-256 checksum
How to use checksums
b44262f702f564c7bc42f8ee1e2a0e89f733ef1b93368d02685b8c1a8c3b1f98
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 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.0.0

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