Skip to main content

CSV exporter plugin for vcti-tree-exporter: writes a vcti tree as a directory tree of CSV tables mirroring the hierarchy, with each node's attributes in a JSON sidecar.

Project description

CSV Tree Exporter

CSV exporter plugin for vcti-tree-exporter: writes a vcti tree as a directory tree of CSV tables.

CsvExporter serializes any vcti-tree tree whose node payloads are vcti-datanode DataNodes as a directory of CSV tables mirroring the hierarchy, and ships a get_exporter_descriptor() factory so a consumer registers it in a catalog and resolves it by id ("csv") or by attribute lookup.

CSV suits light 2-D tables of settings and metadata that load straight into pandas — not heavy result arrays. Use HDF5 or NPZ for complete numeric data.

Tree → CSV mapping

The output path is a directory:

out/
  _attributes.json          # the root node's attributes
  info.attributes.json      # a metadata-only leaf -> sidecar only
  materials/                # a group node -> sub-directory
    props.csv               # a structured-array leaf -> table with a header row
    props.attributes.json   # its attributes
  vec.csv                   # a plain 1-D array -> one value per row
  grid.csv                  # a plain 2-D array -> rows
Tree node On disk
node with children sub-directory named after the node
data leaf <name>.csv (structured → header + rows; plain 1-D/2-D → rows)
a node's attributes <name>.attributes.json (leaf) or _attributes.json (group)
a group node's own array _data.csv inside its directory

Names are sanitized to filesystem-safe segments and de-collided case-insensitively (Mat, matMat, mat~1) so nothing is silently overwritten. An array with more than two dimensions raises UnrepresentableNodeError. CSV does not preserve dtype and the export is one-way.

Usage

from pathlib import Path
from vcti.tree.exporter.core import build_registry, get_exporter
from vcti.tree.exporter.csv import get_exporter_descriptor

registry = build_registry([get_exporter_descriptor()])   # plus any other format plugins
get_exporter(registry, "csv").export(tree, Path("out_dir"), overwrite=True)

overwrite=True replaces the existing output directory — point it at a dedicated path.

Dependencies

  • vcti-tree-exporter — the Exporter protocol and the ExporterDescriptor catalog.
  • vcti-tree / vcti-datanode — the tree and payload types.
  • numpy. (CSV writing itself uses only the standard library.)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vcti_tree_exporter_csv-2.0.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vcti_tree_exporter_csv-2.0.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file vcti_tree_exporter_csv-2.0.0.tar.gz.

File metadata

  • Download URL: vcti_tree_exporter_csv-2.0.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vcti_tree_exporter_csv-2.0.0.tar.gz
Algorithm Hash digest
SHA256 b9017074583995028d8c9323467ef8d18131b87b45710c9f4938da7ec29fbc8e
MD5 61f874b877c3dbc0542f80f4c5d16e81
BLAKE2b-256 df96832310577a74ddcb8b6614de4878d9591336d5de51b4ea365344f9938da8

See more details on using hashes here.

Provenance

The following attestation bundles were made for vcti_tree_exporter_csv-2.0.0.tar.gz:

Publisher: release.yml on vcollab/vcti-python-tree-exporter-csv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vcti_tree_exporter_csv-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for vcti_tree_exporter_csv-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57965fbaee3df30886f5d169e6c3425a20862ff80db070fffabe18ffc8c13442
MD5 5f0074037f3001e0ebeb81b4b8a2588d
BLAKE2b-256 40b4c0052b7d3fd2dfeea3d3227cd5cb895e5964ce98ff061dab79cb8ab2d189

See more details on using hashes here.

Provenance

The following attestation bundles were made for vcti_tree_exporter_csv-2.0.0-py3-none-any.whl:

Publisher: release.yml on vcollab/vcti-python-tree-exporter-csv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page