// 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 forty-four - and raises instead of quietly corrupting your data.

$ pip install polyxios docs() -> formats() ->
44formats
1dependency
0silent truncations
mmaplazy reads
read_write.py- □ ×
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)

# a buffer or a .gz, same call
mesh = px.read(buf, fmt=".ply")
mesh = px.read("brain.vol.gz")█

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.

formatextreadwritelazy
VTK Legacy.vtk[x][x]mmap: v5.1 all, v4.2 all but cells VTK RectilinearGrid.vtr[x][x]- - - - VTK PolyData.vtp[x][x]mmap: raw appended Wavefront OBJ.obj[x][x]- - - - Stanford PLY.ply[x][x]mmap: vertices STL.stl[x][x]skips dedup 3MF.3mf[x][x]objects: tags OFF.off[x][x]- - - - Abaqus.inp[x][x]- - - - AVS-UCD.avs[x][x]- - - - Medit binary.meshb[x][x]mmap: vertices Medit ASCII.mesh .medit[x][x]- - - - DOLFIN / FEniCS XML.xml[x][x]- - - - FLAC3D.f3grid[x][x]- - - - glTF 2.0.gltf .glb[x][x]scene: read_scene COLLADA.dae[x][x]scene: read_scene Gmsh.msh*[x][x] v2 only- - - - Nastran.bdf .nas .fem .dat[x][x]- - - - Tecplot ASCII.tec .dat[x][x]- - - - SU2.su2[x][x]- - - - TetGen.ele + .node[x][x]- - - - Well-Known Text.wkt[x][x]- - - - VTK UnstructuredGrid.vtu[x][x]mmap: raw appended VTK StructuredGrid.vts[x][x]- - - - VTK ImageData.vti[x][x]- - - - VTKHDF.vtkhdf[x][x]step= on read PVD (ParaView collection).pvd[x][x]step= on read MFEM mesh.mesh[x][x]- - - - Netgen.vol[x][x]- - - - UGRID (AFLR).ugrid[x][x]- - - - Gaussian splat.splat[x][x]mmap: all PCD (Point Cloud Library).pcd[x][x]mmap: binary LAS / LAZ (LiDAR).las .laz[x][x]mmap: .las ASCII point cloud.xyz .pts .ptx[x][x]- - - - Kratos MDPA.mdpa[x][x]- - - - PERMAS.dato .post .dat*[x][x]- - - - ANSYS Fluent.msh* .fluent[x][x]- - - - SVG.svg[ ][x]- - - - XDMF.xdmf .xmf[x][x]mmap: sidecars MED (Salome).med[x][x]- - - - CGNS.cgns[x][x]- - - - H5M (MOAB).h5m[x][x]- - - - HMF.hmf[x][x]- - - - Exodus II.e .exo .ex2[x][x]step= on read

} // 44 codecs, the 56 extensions above plus .plt, recognised but not read - .svg is written, never read; .mesh is shared by Medit ASCII and MFEM, .msh by Gmsh and Fluent, each resolved by content

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
bash - 80×24
$ pxios fetch stanford-bunny.obj
  Successfully fetched to: ~/.polyxios/obj/stanford-bunny.obj

$ pxios convert stanford-bunny.obj bunny.vtk
  Reading 'stanford-bunny.obj'...
  Read in 0.1680 seconds
  Writing to 'bunny.vtk'...
  Wrote in 0.0476 seconds
  Conversion successful.

$ pxios list --codecs
  File formats supported by polyxios codecs:
    abaqus (.inp)
    ...
    medit (.medit, .meshb)
    medit/mesh (.mesh)
    ...
    permas/tecplot/nastran (.dat)
    ...
    tecplot (.plt, .tec)
    ...
    wkt (.wkt)

$ pxios viz bunny.vtk --points
  Reading bunny.vtk ...
  Loaded in 0.0814 seconds
  35947 vertices | 69451 elements | vertex attrs: none
  Opening FURY window ...
  Rendering strictly as point cloud per --points request.

04 // plugins

register() -> ".abc"

Any third-party package can teach polyxios a forty-fifth format. Two functions and an entry point - no fork, no pull request, no restart.

step 01 - mypackage/abc_codec.py
from polyxios._registry import Codec

def read(path, *, lazy=False): ...
def write(poly, path, **opts): ...

def register():
    return ".abc", Codec(read, write)
step 02 - pyproject.toml
[project.entry-points."polyxios.codecs"]
abc = "mypackage.abc_codec:register"

# then, anywhere:
mesh = px.read("model.abc")
# picked up automatically

Full plugin guide ->