Skip to main content

Path Format Descriptors

Built-in file format descriptors (HDF5, CAX, JSON, NPY, NPZ, CSV) for the vcti-path-format identification framework

Overview

vcti-path-format-descriptors ships ready-made FormatDescriptor instances for the file formats VCTI tooling needs to recognize: HDF5, VCollab CAX, JSON, NumPy NPY/NPZ, and CSV. Each descriptor is built by a factory function that wires a file-only precondition and the appropriate magic-byte and/or extension validators onto a HeuristicEvaluator, tags the result with attributes from the shared vocabulary (vcti-path-format-attributes), and returns it for registration with a FormatRegistry. Applications register the descriptors they need (or all of them at once) and let FormatIdentifier do the identification.

Installation

pip install "vcti-path-format-descriptors>=2.0.0"

In pyproject.toml dependencies

dependencies = [
    "vcti-path-format-descriptors>=2.0.0",
]

Quick Start

from pathlib import Path

from vcti.pathformat.core import FormatIdentifier, FormatRegistry
from vcti.pathformat.descriptors import HDF5_SIGNATURE, register_all_formats

# Register all built-in format descriptors
registry = FormatRegistry()
register_all_formats(registry)

# Identify a file
path = Path("data.h5")
path.write_bytes(HDF5_SIGNATURE + b"\x00" * 64)

identifier = FormatIdentifier(registry)
best = identifier.get_best_match(path)
print(best.id if best else "unknown")  # hdf5-file

for result in identifier.identify_file_format(path)[:2]:
    print(result.descriptor.id, result.confidence.name)

Individual descriptors

from vcti.pathformat.core import FormatRegistry
from vcti.pathformat.descriptors import (
    get_csv_file_descriptor,
    get_hdf5_file_descriptor,
)

registry = FormatRegistry()
registry.register(get_hdf5_file_descriptor())
registry.register(get_csv_file_descriptor())

Each factory returns a new descriptor on every call, so a descriptor can be registered in several registries or adjusted without affecting others.


API

Name Kind Purpose
register_all_formats(registry) function Register all six built-in descriptors, or none if any ID is taken
get_<format>_file_descriptor() function Build one descriptor (hdf5, cax, json, npy, npz, csv)
<FORMAT>_FILE_FORMAT_DESCRIPTOR_ID constant The descriptor's registry ID
HDF5_SIGNATURE, CAX_FILE_SIGNATURE, NPY_SIGNATURE, NPZ_SIGNATURE, NPZ_EMPTY_SIGNATURE constant Magic-byte signatures, as bytes
HDF5_SUPERBLOCK_OFFSETS constant Offsets at which the HDF5 signature is accepted
NpzMembersValidator class STRUCTURE-tier GATE: every ZIP member is an .npy file
GENERATOR_APPLICATION constant The CAX descriptor's generator attribute value

Built-in Formats

Every descriptor first requires a regular file (a PathKind.FILE precondition), so a directory is ruled out before any file is read.

ID Signature Extensions Best confidence Attributes
hdf5-file \x89HDF\r\n\x1a\n at offset 0, 512, 1024, 2048, … .h5, .hdf5 DEFINITE structure=hdf5
vcti-cax \x89VCF\r\n\x1a\n — DEFINITE structure=binary, generator=VCollab, content=[4 values]
json-file — (text format) .json LIKELY structure=json
npy-file \x93NUMPY .npy DEFINITE structure=binary
npz-file PK\x03\x04, or PK\x05\x06 for an empty archive; members all .npy .npz DEFINITE structure=binary
csv-file — (text format) .csv LIKELY structure=csv

How the validators combine:

  • Signature and extension both match — DEFINITE.
  • Signature matches, extension does not (a renamed file) — LIKELY, so get_best_match() still finds it.
  • Signature does not match — CERTAINLY_NOT, whatever the extension.
  • Text formats (JSON, CSV) have no signature; the extension alone gives LIKELY, and the content is not inspected. They have priority=-1, so when a renamed binary file is LIKELY for both its own format and a text format, its own format ranks first.
  • Extensions are compared case-insensitively.

An HDF5 file may start with a user block, so the signature is accepted at any offset the HDF5 specification allows. A MATLAB v7.3 .mat file, which is HDF5 behind a 512-byte header, is therefore LIKELY as HDF5.

The NPZ signature is a generic ZIP signature. At the STRUCTURE tier, the NPZ descriptor also lists the archive's members (reading only the ZIP central directory) and rules out an archive with any member that is not an .npy file. A caller that passes max_tier=ValidationTier.IDENTIFICATION skips that check and relies on the signature and the .npz extension.


Dependencies

Documentation

If you want to… Read
Get started using the package Quick Start above
Understand the design decisions docs/design.md
Navigate and understand the source docs/source-guide.md
Add a new format descriptor docs/extending.md

Metadata

Release files for vcti-path-format-descriptors 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-path-format-descriptors 2.0.0
File Size Uploaded Provenance Actions
vcti_path_format_descriptors-2.0.0.tar.gz 24.2 kB With provenance Details for vcti_path_format_descriptors-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vcti-path-format-descriptors 2.0.0
File Interpreter ABI Platform Actions
vcti_path_format_descriptors-2.0.0-py3-none-any.whl Python 3 none any Details for vcti_path_format_descriptors-2.0.0-py3-none-any.whl

Total release size: 37.2 kB

Release files / vcti_path_format_descriptors-2.0.0.tar.gz

Download URL vcti_path_format_descriptors-2.0.0.tar.gz
Size 24.2 kB
Tags Source
SHA-256 checksum
How to use checksums
96adb48634baa482192a84bf447c5394eb3263df9f25c0d1d7ff93db0671e34e
BLAKE2b-256 checksum
How to use checksums
9dd1e333915eda0f120cf6b14fa016503a70adcc218301f77bcf4774c30cf84f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 22, 2026.

Transparency log

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

Download URL vcti_path_format_descriptors-2.0.0-py3-none-any.whl
Size 13.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d193609c742861bbf2e32b53122434408dba4f18c742f9c16f5cdc4f58535a00
BLAKE2b-256 checksum
How to use checksums
71cf15418136f49b3d634e37c6bd8b887e080bd720adc0f134bd5da8bfd8701f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 22, 2026.

Transparency log

Security for vcti-path-format-descriptors 2.0.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for vcti_path_format_descriptors-2.0.0.tar.gz

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 Nov 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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