Base classes for mesh fileloader plugins producing mesh-schema DataNode trees
Project description
vcti-fileloader-mesh
Base classes for mesh fileloader plugins producing mesh-schema DataNode trees.
Overview
vcti-fileloader-mesh is the shared base of the mesh loader family. A
mesh format loader (SLIM, PLY, ...) differs from its siblings only in how
it opens a file and enumerates its blocks; everything else — the subtree
transaction, lazy-vs-eager attachment, schema guarantees, locking, and
rollback — is identical. MeshLoaderBase implements that shared part
once: subclasses provide can_load / load / unload plus a
block_specs() that yields one MeshBlockSpec per block, and inherit a
populate() that grafts a locked, mesh-schema-conforming
subtree into any LockableTree. The result satisfies the
vcti.fileloader.core.Loader protocol, so mesh loaders register and
dispatch like every other fileloader plugin.
Installation
pip install vcti-fileloader-mesh
In requirements.txt
vcti-fileloader-mesh>=1.0.0
In pyproject.toml dependencies
dependencies = [
"vcti-fileloader-mesh>=1.0.0",
]
Quick Start
A complete mesh format loader is the format-specific part only:
from pathlib import Path
from typing import Any
from vcti.fileloader.mesh import MeshBlockSpec, MeshLoaderBase
class MyMeshLoader(MeshLoaderBase):
id = "mymesh-numpy-loader"
def can_load(self, path: Path) -> bool:
return path.suffix.lower() == ".mymesh"
def load(self, path: Path, **options: Any):
return open_my_format(path) # opaque handle
def unload(self, handle) -> None:
handle.close() # idempotent
def block_specs(self, handle, **options):
for element in handle.header: # cheap metadata only
yield MeshBlockSpec(
name=element.name, # "node", "triangle", ...
count=element.count,
dtype=element.record_dtype,
read=lambda e=element: handle.read_block(e),
)
Using it is the standard fileloader lifecycle:
from vcti.fileloader.core import DataNode
from vcti.tree.core import DictTree
loader = MyMeshLoader()
tree = DictTree(root_data=DataNode())
with loader.open(Path("part.mymesh")) as handle:
mesh_root = loader.populate(handle, tree, tree.root_handle)
Blocks attach lazily — nothing is read until a block's .load() — and
the subtree is guaranteed to conform to the mesh schema's structure, so
vcti.mesh.schema accessors and the mesh exporters consume it directly.
API surface
| Name | Kind | Purpose |
|---|---|---|
MeshLoaderBase |
ABC | populate() template; subclasses add can_load/load/unload/block_specs |
MeshLoaderBase.populate(handle, tree, parent, *, before_lock, lazy) |
method | Attach a locked mesh subtree (lazy blocks by default) |
MeshLoaderBase.root_attributes(handle) |
hook | File-native attributes for the mesh root (default: none) |
MeshLoaderBase.open(path) |
context manager | load()/unload() pairing |
MeshBlockSpec |
dataclass | One block: name, count, dtype, read callable, attributes |
See docs/design.md for the model and docs/extending.md for the full guide to writing a format loader.
Dependencies
- vcti-fileloader — the
Loadercontract andSubtreeBuilder. - vcti-mesh-schema — the mesh block schema the base assembles.
- numpy — block arrays.
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_fileloader_mesh-1.0.0.tar.gz.
File metadata
- Download URL: vcti_fileloader_mesh-1.0.0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c065b2f7e102e71f559ec8661651f027ad21357673709d8710cddf56b64b93e6
|
|
| MD5 |
39ace946f471ab04964efdbd9d6934d4
|
|
| BLAKE2b-256 |
8e434beb77dac18ea34ebc1a06a3898e805f087b033a7df61ea202189c21a0aa
|
Provenance
The following attestation bundles were made for vcti_fileloader_mesh-1.0.0.tar.gz:
Publisher:
release.yml on vcollab/vcti-python-fileloader-mesh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_fileloader_mesh-1.0.0.tar.gz -
Subject digest:
c065b2f7e102e71f559ec8661651f027ad21357673709d8710cddf56b64b93e6 - Sigstore transparency entry: 2188106049
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-fileloader-mesh@c81db032cb55345baabaaeef200cdc2182b8b16b -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c81db032cb55345baabaaeef200cdc2182b8b16b -
Trigger Event:
push
-
Statement type:
File details
Details for the file vcti_fileloader_mesh-1.0.0-py3-none-any.whl.
File metadata
- Download URL: vcti_fileloader_mesh-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.1 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 |
fbe5feffb9adb199b1816b82c520860e8e273518c481d002d01034b1dc42413e
|
|
| MD5 |
be72e5516f6e4f64780b3b8018db01ab
|
|
| BLAKE2b-256 |
c5a12a8e9aa0de359e66155688d151a83cc5ede9792ac6ebfd5be5a5b7ecefc0
|
Provenance
The following attestation bundles were made for vcti_fileloader_mesh-1.0.0-py3-none-any.whl:
Publisher:
release.yml on vcollab/vcti-python-fileloader-mesh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_fileloader_mesh-1.0.0-py3-none-any.whl -
Subject digest:
fbe5feffb9adb199b1816b82c520860e8e273518c481d002d01034b1dc42413e - Sigstore transparency entry: 2188106061
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-fileloader-mesh@c81db032cb55345baabaaeef200cdc2182b8b16b -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c81db032cb55345baabaaeef200cdc2182b8b16b -
Trigger Event:
push
-
Statement type: