PyRXMesh

PyRXMesh brings RXMesh GPU mesh processing to Python. PyRXMesh allows using Python and PyTorch to organize an application, while RXMesh accelerates the mesh processing and automatic differentiation on the GPU.
PyRXMesh provides:
- triangle meshes built from OBJ files or NumPy arrays
- vertex, edge, and face attributes on the host and GPU
- NumPy, SciPy, and PyTorch interoperability
- dense and sparse matrices and linear solvers
- small compiled plugins for custom RXMesh CUDA operations
- differentiable scalar energies that can be interop with PyTorch autograd.
Install
python -m pip install PyRXMesh
PyRXMesh needs an NVIDIA GPU and a driver compatible with the CUDA version in the wheel. PyTorch and SciPy are optional. Install SciPy normally, and choose the CUDA-enabled PyTorch build for your system from the PyTorch installation page.
Visualization is optional and it depends on Polyscope:
python -m pip install "PyRXMesh[viz]"
Python cuDSS solvers can be installed as an optional CUDA 12 dependency:
python -m pip install "PyRXMesh[cudss]"
This installs NVIDIA's nvmath-python[cu12] bundle. Its sparse direct solver accepts the Torch CSR tensor exported by energy.hessian_view.to_torch("device").
For a source build, see docs/DEVELOPING.md.
Create a mesh
Initialize RXMesh once, then load a mesh or build one from arrays:
import pyrxmesh as rx
rx.init(0) #0: GPU id
vertices, faces = rx.create_plane(32, 32, dx=0.05)
mesh = rx.RXMeshStatic(vertices, faces)
print(mesh.num_vertices, mesh.num_edges, mesh.num_faces)
velocity = mesh.add_vertex_attribute("velocity", dtype="float32", dim=3)
velocity.reset(0, "device")
RXMeshStatic("mesh.obj") loads an OBJ file. Mesh and attribute arrays use RXMesh linear order by default and maps are available when an application needs input/global order.
See examples/load_and_show.py for mesh inspection and Polyscope visualization, and the tests examples on mesh construction and export and attributes handling.
Automatic differentiation and PyTorch interop
A differentiable plugin defines one or more scalar energy terms as RXMesh CUDA lambdas. We provide a starter plugin/python module which creates an independent project with boilerplate code (pyproject.toml, CMakeLists.txt, etc) needed to compile the CUDA lambda function and build their python bindings:
python -m pyrxmesh.diff_plugin my_energy
The user writes their energy terms in .cu file. Once built, PyRXMesh evaluates its value and gradient on the GPU and exposes the result to PyTorch:
import torch
import my_energy
energy = my_energy.make_energy(mesh, {"weight": 0.5})
x = torch.as_tensor(
mesh.vertices(), dtype=torch.float32, device="cuda"
).requires_grad_()
loss = energy.torch(x)
loss.backward()
The gradient flows through whatever PyTorch computation produced x. For an optimizer that accepts a value and gradient directly, use energy.value_and_grad() instead of creating an autograd node.
The starter contains the CUDA term, Python package, build files, and run script. See Writing Differentiable Energy Plugins for the complete workflow, including query selection, fixed attributes, row order, and zero-copy input.
Exchange data with Python
Attributes are attached to vertices, edges, or faces. They use SoA layout by default and may have host storage, device storage, or both.
coords = mesh.input_vertex_coordinates()
host_view = coords.to_numpy("host") #Zero-copy numpy view
device_tensor = coords.to_torch("device") #Zero-copy pytorch view
owned_array = coords.to_numpy_copy(source="host") #deep copy
Unsuffixed to_* methods return a zero-copy view when supported. Methods ending in _copy return independent storage. Host and device allocations are separate; use attribute.move(source, target) when one side must receive changes from the other.
Mesh ordering maps, face arrays, and the Polyscope edge permutation are available directly from RXMeshStatic. See tests/test_core_mesh.py and tests/test_attributes.py for the supported operations.
Add custom CUDA operations
When an operation cannot be expressed efficiently from Python, generate a small plugin and write only the RXMesh device lambda:
python -m pyrxmesh.plugin my_kernels
The generated package builds against the PyRXMesh installation in the active environment. See Writing Custom CUDA Plugins and examples/custom_kernel_plugin.
Matrices and solvers
PyRXMesh exposes dense matrices, CSR sparse matrices, mesh-derived sparsity patterns, iterative solvers, and optional direct solvers. Dtypes, storage locations, matrix order, and mesh query patterns use short string arguments where they apply.
Documentation
Metadata
Release files for PyRXMesh 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyrxmesh-0.3.2.tar.gz | 145.8 kB | With provenance | Details for pyrxmesh-0.3.2.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| pyrxmesh-0.3.2-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details for pyrxmesh-0.3.2-cp312-cp312-win_amd64.whl |
| pyrxmesh-0.3.2-cp312-cp312-manylinux_2_28_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.28+ x86-64 | Details for pyrxmesh-0.3.2-cp312-cp312-manylinux_2_28_x86_64.whl |
| pyrxmesh-0.3.2-cp311-cp311-win_amd64.whl | CPython 3.11 | CPython 3.11 | Windows x86-64 | Details for pyrxmesh-0.3.2-cp311-cp311-win_amd64.whl |
| pyrxmesh-0.3.2-cp311-cp311-manylinux_2_28_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.28+ x86-64 | Details for pyrxmesh-0.3.2-cp311-cp311-manylinux_2_28_x86_64.whl |
| pyrxmesh-0.3.2-cp310-cp310-win_amd64.whl | CPython 3.10 | CPython 3.10 | Windows x86-64 | Details for pyrxmesh-0.3.2-cp310-cp310-win_amd64.whl |
| pyrxmesh-0.3.2-cp310-cp310-manylinux_2_28_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.28+ x86-64 | Details for pyrxmesh-0.3.2-cp310-cp310-manylinux_2_28_x86_64.whl |
Total release size: 706.3 MB
Release files / pyrxmesh-0.3.2.tar.gz
| Download URL | pyrxmesh-0.3.2.tar.gz |
|---|---|
| Size | 145.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c90669ce44df24e40d1c25a9561bab1c6aa9a0f98569c4f8f2db8c2bea04da8f
|
|
BLAKE2b-256 checksum How to use checksums |
8c5c6a6b9d47f6c36b070cb9fb425e72e0a054b70cc003eec97d054a495af0c8
|
| 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 8, 2026.
Transparency logRelease files / pyrxmesh-0.3.2-cp312-cp312-win_amd64.whl
| Download URL | pyrxmesh-0.3.2-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 135.0 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e5c4312728942fc7bc181a3e302b347641b64f92e5da1a9e428abae5200db76a
|
|
BLAKE2b-256 checksum How to use checksums |
24796de0ea5d73374e8243a5af079883e32b739906035ef1cc1f15d996c7280e
|
| 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 8, 2026.
Transparency logRelease files / pyrxmesh-0.3.2-cp312-cp312-manylinux_2_28_x86_64.whl
| Download URL | pyrxmesh-0.3.2-cp312-cp312-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 100.4 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
369cc2442e9f9b2ea65e8d9e8a881c22efbef27d33f641567e77e9ed89eff083
|
|
BLAKE2b-256 checksum How to use checksums |
b0e5068ce7ab4d6d27f3a16def64973e10942e9aacb8a54e8c1ee2b7f8ce081f
|
| 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 8, 2026.
Transparency logRelease files / pyrxmesh-0.3.2-cp311-cp311-win_amd64.whl
| Download URL | pyrxmesh-0.3.2-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 135.0 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
01f95691841fd536f62d36919209529315d6a2fa41ac8b5bb11a9f3fdd45dd90
|
|
BLAKE2b-256 checksum How to use checksums |
091be9b33b2ba93c6433e94ff05d5b7b0c6a08109c85e3c1c34aebabb7e14510
|
| 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 8, 2026.
Transparency logRelease files / pyrxmesh-0.3.2-cp311-cp311-manylinux_2_28_x86_64.whl
| Download URL | pyrxmesh-0.3.2-cp311-cp311-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 100.4 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
8320240fc74cfbaacf580feff64b5619063774dfa3419321c566e1707c94c5d4
|
|
BLAKE2b-256 checksum How to use checksums |
b3ff79fa9f5b9cebe6f7ea9540b4e5afa75ad6967077eb2fe47fda3d204fb79f
|
| 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 8, 2026.
Transparency logRelease files / pyrxmesh-0.3.2-cp310-cp310-win_amd64.whl
| Download URL | pyrxmesh-0.3.2-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 135.0 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a2234d878c52768bd6bacf241b93af4ac275d4fa066027d16b5d85430a318278
|
|
BLAKE2b-256 checksum How to use checksums |
926f4de91e9dfae456f54a1a67412c884682766677e934af575450057a954f94
|
| 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 8, 2026.
Transparency logRelease files / pyrxmesh-0.3.2-cp310-cp310-manylinux_2_28_x86_64.whl
| Download URL | pyrxmesh-0.3.2-cp310-cp310-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 100.4 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
9903865b9c9e7e885cd11ce77e2fe9d9ee12a1d7c7dac20f00682d0685837218
|
|
BLAKE2b-256 checksum How to use checksums |
c58f2f7fdb0a5171021b99f013a62cf9b54824f0f06a7f306dd2a134757dd55b
|
| 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 8, 2026.
Transparency logSecurity for PyRXMesh 0.3.2
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
All 7 files in this release have been uploaded with provenance metadata.
Attestation for pyrxmesh-0.3.2.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 8, 2026.
Transparency logA 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.