Skip to main content

BRepAX

CI PyPI License Python 3.11+

JAX-native differentiable geometry and STEP/B-Rep evaluation.

BRepAX combines host-side OCCT extraction with JAX numerical evaluation of analytical primitives and B-spline surfaces. It provides mesh-based mass properties, parameter gradients on fixed mesh topology, and experimental stratum-dispatched Boolean measures.

Installation

pip install brepax "cadquery-ocp-novtk>=7.9,<8"

The explicit OCCT bound is needed for the published 0.6.1 package, whose metadata also allows incompatible OCCT 8 bindings.

Quick Start

import jax
from brepax.io.step import read_step
from brepax.brep.triangulate import (
    triangulate_shape, divergence_volume,
    mesh_surface_area, mesh_center_of_mass,
)

# Load STEP file and compute volume via divergence theorem
shape = read_step("part.step")
tris, params = triangulate_shape(shape)

vol = divergence_volume(tris)           # exact for watertight mesh
area = mesh_surface_area(tris)          # sum of triangle areas
com = mesh_center_of_mass(tris)         # surface integral (Eberly 2002)

# Gradient of volume w.r.t. all triangle vertices
grad = jax.grad(divergence_volume)(tris)

Speeding up cold starts

BRepAX compiles one XLA artifact per surface type and per unique B-spline signature on the first triangulation. On busy parts (e.g. NIST CTC-02, 664 faces) this is ~10 seconds of one-shot work per Python process. Enabling the persistent compilation cache lets later process starts reuse those compiled artifacts from disk:

import brepax
from brepax.io.step import read_step
from brepax.brep.triangulate import triangulate_shape

brepax.enable_compilation_cache()  # defaults to ~/.cache/brepax/jax-compile

# First run populates the cache on disk, later runs load from it.
shape = read_step("part.step")
tris, _ = triangulate_shape(shape)

The cache directory can also be set explicitly or via the BREPAX_COMPILATION_CACHE_DIR environment variable. In-process repeat calls are unaffected — they already hit JAX's in-memory JIT cache.

Capabilities and limits

See the API overview for supported STEP surfaces, the host/JAX boundary, mass-property assumptions, and the scope of Boolean gradients. The integration report records results on its fixture set; it is not a guarantee for arbitrary CAD.

Documentation

Full documentation: lv416e.github.io/brepax

License

Apache License 2.0. See LICENSE for details.

Metadata

Release files for brepax 0.6.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for brepax 0.6.2
File Size Uploaded Provenance Actions
brepax-0.6.2.tar.gz 622.9 kB With provenance Details for brepax-0.6.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for brepax 0.6.2
File Interpreter ABI Platform Actions
brepax-0.6.2-py3-none-any.whl Python 3 none any Details for brepax-0.6.2-py3-none-any.whl

Total release size: 763.7 kB

Release files / brepax-0.6.2.tar.gz

Download URL brepax-0.6.2.tar.gz
Size 622.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4229fe9deb534ce1652a09cdbfb8e1ca7244a2b3b3679963e7a8e072e46e9ac6
BLAKE2b-256 checksum
How to use checksums
c2f1d467d20ab8d0ce1f1ccedb7f7292cb198d95c8b8792f21e8490d9a79f3d2
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 Oct 28, 2026.

Transparency log

Release files / brepax-0.6.2-py3-none-any.whl

Download URL brepax-0.6.2-py3-none-any.whl
Size 140.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b4764144a595e46e283e04839e589159224b5883486a0174e5bab67e88c08ae
BLAKE2b-256 checksum
How to use checksums
735fd14a9b221675c0d055da0104484f8c4bf432c87915fa396ecb25b7066881
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 Oct 28, 2026.

Transparency log

Security for brepax 0.6.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

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

Select from 2 files

Attestation for brepax-0.6.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 Oct 28, 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