// read_anything()
ONE LINE IN.
ANY MESH OUT.
Reading 3D meshes in Python normally means installing one library per format. polyxios is a single small, maintained package that reads and writes all twenty-five — and raises instead of quietly corrupting your data.
import polyxios as px mesh = px.read("brain.vtk") mesh.vertices.shape # (n, 3) len(mesh.element_types) # 2 px.write(mesh, "brain.ply") px.write(mesh, "brain.stl", binary=True) # gigabytes? memory-map it mesh = px.read("huge.vtk", lazy=True)█
01 // formats
supported_extensions()
Every format carries its own page: what the specification says, what polyxios does with it, and a link to the authoritative document.
} // 25 codecs, 34 extensions
02 // guarantees
assert not corrupted
[00]
No silent corruption
Large mesh indices raise an error instead of quietly truncating to a narrower integer.
[01]
Groups preserved
A face belonging to several tags stays in all of them, through a full read-write round trip.
[02]
Safe on untrusted files
Header counts are validated before any memory is allocated for the body.
[03]
No compiler needed
Pure Python fallbacks ship with the package; the Cython hot-paths are optional.
03 // cli
$ pxios
Ships with the package. Pull a catalogued model, convert it, and render it through FURY without writing a script.
- list
- remote catalogue, local cache, or codecs
- fetch
- one file, or every model for an extension
- convert
- format to format in a single process
- viz
- surface, --lines or --points
$ pxios fetch bunny.obj cached -> ~/.polyxios/bunny.obj (2.9 MB) $ pxios convert bunny.obj bunny.vtk 35947 vertices · 69451 triangles · 0.4s $ pxios list --codecs .avs .bdf .ele .f3grid .inp .meshb .msh .obj .off .ply .stl .su2 .tec .vtk .vtp .vtr .wkt .xml $ pxios viz bunny.vtk --points█
04 // plugins
register() -> ".abc"
Any third-party package can teach polyxios a nineteenth format. Two functions and an entry point — no fork, no pull request, no restart.
from polyxios._registry import Codec def read(path, *, lazy=False): ... def write(poly, path, **opts): ... def register(): return ".abc", Codec(read, write)
[project.entry-points."polyxios.codecs"] abc = "mypackage.abc_codec:register" # then, anywhere: mesh = px.read("model.abc") # picked up automatically