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

Version 0.6.2 includes the required OCCT dependency bound. For 0.6.1, use pip install "brepax==0.6.1" "cadquery-ocp-novtk>=7.9,<8".

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.7.0

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.7.0
File Size Uploaded Provenance Actions
brepax-0.7.0.tar.gz 965.5 kB With provenance Details for brepax-0.7.0.tar.gz

Built distribution (wheel)

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

Total release size: 1.2 MB

Release files / brepax-0.7.0.tar.gz

Download URL brepax-0.7.0.tar.gz
Size 965.5 kB
Tags Source
SHA-256 checksum
How to use checksums
989e4e86c334fe6dccb5dcc9ece808a1e321d540128386a2752d4a879483fdff
BLAKE2b-256 checksum
How to use checksums
a62583542644e609c6371127daf9416d0a80226090c76d0eb6be7163dd9b679e
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 6, 2026.

Transparency log

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

Download URL brepax-0.7.0-py3-none-any.whl
Size 254.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
719b05bfda83d61d38879e2f1c1faee6fd82c7d89ce51e9266046e370a5722f0
BLAKE2b-256 checksum
How to use checksums
7ac3d929483386e9f77229afb97f03c9cfd07dcc466a049de25fd280213f400f
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 6, 2026.

Transparency log

Security for brepax 0.7.0

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.7.0.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 6, 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