Skip to main content

Nanobind wrapper for OCCT

Project description

compas_occt

Direct, lean nanobind bindings to the OpenCASCADE Technology (OCCT) 8 geometry kernel, packaged as a drop-in replacement for compas_occ.

compas_occt exposes the exact same public API as compas_occ — NURBS curves and surfaces (OCCNurbsCurve, OCCNurbsSurface), Boundary Representations (OCCBrep and its vertex/edge/loop/face components), booleans, fillet/offset/slice, STEP/IGES/STL/BREP I/O, and the COMPAS plugin factories so compas.geometry.Brep.from_box(...) returns an OCCBrep. The difference is the backend: instead of pythonocc-core, it links OCCT directly through a single compiled extension module, with no pythonocc-core dependency.

Design

  • One extension module. All OCCT-backed functions live in a single compas_occt._occt module that links OCCT exactly once. This keeps RTTI/memory consistent across the whole API (required for STEP/IGES) and is far leaner than one OCCT copy per submodule.
  • Functional backend + opaque handles. Thin C++ free functions operate on four opaque handle wrappers (Shape, GeomCurve, Geom2dCurve, GeomSurface); the Python classes hold one of these in self._native and delegate.
  • Zero-copy data transfer. Bulk coordinate data (mesh tessellation, NURBS control points, curve discretisation) crosses the C++↔Python boundary as numpy arrays that view the C++ buffer directly (no copy). numpy — not jax — is the right tool here: it is the zero-copy buffer-protocol partner for nanobind's ndarray, lightweight, and already a dependency.

Installation

pip install compas_occt

Development install (builds OCCT 8 from source on first build; cached afterwards):

git clone https://github.com/petrasvestartas/compas_occt.git
cd compas_occt
pip install --no-build-isolation -ve ".[dev]"

A C++17 compiler, CMake ≥ 3.15 and Ninja are required for the source build. On Windows, run the command from a Visual Studio "x64 Native Tools" prompt (or after calling vcvars64.bat).

Development with uv

uv gives a fast, reproducible environment. The first build downloads and compiles OCCT 8 (~30–60 min); it is then cached in external/occt, so later builds take a few minutes.

# 1. create the environment (Python >= 3.9; 3.14 is used here)
uv venv --python 3.14

# 2. install the build backend + the runtime and dev/docs dependencies
uv pip install scikit-build-core nanobind cmake ninja
uv pip install -e ".[dev,docs]" --no-build-isolation

# 3. (only to run the viewer examples) install compas_viewer and patch it for Python 3.14
uv pip install compas_viewer
python tools/patch_compas_viewer.py

# 4. run the tests, examples, or docs
uv run pytest tests/ -v
uv run mkdocs serve
uv run python docs/examples/breps/brep_booleans.py

On Windows, run the commands from a Visual Studio "x64 Native Tools" prompt (or after calling vcvars64.bat) so the MSVC toolchain and the .venv are both on PATH.

Python 3.14 note. compas_viewer 2.0.2 crashes on Python 3.14 (it reads self.__annotations__ in a dataclass, which PEP 749 no longer resolves to the class). tools/patch_compas_viewer.py applies the one-line upstream fix; it is idempotent and only needed to run the visualisation examples (the core compas_occt API does not need it).

Usage

from compas.geometry import Box, Point
from compas.geometry import Brep, NurbsCurve

# COMPAS plugin dispatch -> OCC implementation
brep = Brep.from_box(Box(1))
brep.to_step("box.step")

curve = NurbsCurve.from_points([Point(0, 0, 0), Point(3, 6, 0), Point(6, -3, 3), Point(10, 0, 0)])
print(curve.length())

Tests

pip install --no-build-isolation -ve ".[dev]"
python -m pytest tests/ -v

Documentation

Built with mkdocs (pip install -e ".[docs]", then mkdocs serve). Mirrors the compas_occ tutorial, examples, and API reference.

Issue Tracker

Please report bugs on the issue tracker.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

compas_occt-0.1.17.tar.gz (5.9 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

compas_occt-0.1.17-cp312-abi3-win_amd64.whl (10.4 MB view details)

Uploaded CPython 3.12+Windows x86-64

compas_occt-0.1.17-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (19.8 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

compas_occt-0.1.17-cp312-abi3-macosx_11_0_x86_64.whl (15.9 MB view details)

Uploaded CPython 3.12+macOS 11.0+ x86-64

compas_occt-0.1.17-cp312-abi3-macosx_11_0_arm64.whl (14.5 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

compas_occt-0.1.17-cp311-cp311-win_amd64.whl (10.4 MB view details)

Uploaded CPython 3.11Windows x86-64

compas_occt-0.1.17-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (19.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

compas_occt-0.1.17-cp311-cp311-macosx_11_0_x86_64.whl (15.9 MB view details)

Uploaded CPython 3.11macOS 11.0+ x86-64

compas_occt-0.1.17-cp311-cp311-macosx_11_0_arm64.whl (14.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

compas_occt-0.1.17-cp310-cp310-win_amd64.whl (10.4 MB view details)

Uploaded CPython 3.10Windows x86-64

compas_occt-0.1.17-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (19.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

compas_occt-0.1.17-cp310-cp310-macosx_11_0_x86_64.whl (15.9 MB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

compas_occt-0.1.17-cp310-cp310-macosx_11_0_arm64.whl (14.5 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

compas_occt-0.1.17-cp39-cp39-win_amd64.whl (10.4 MB view details)

Uploaded CPython 3.9Windows x86-64

compas_occt-0.1.17-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (19.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

compas_occt-0.1.17-cp39-cp39-macosx_11_0_x86_64.whl (15.9 MB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

compas_occt-0.1.17-cp39-cp39-macosx_11_0_arm64.whl (14.5 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file compas_occt-0.1.17.tar.gz.

File metadata

  • Download URL: compas_occt-0.1.17.tar.gz
  • Upload date:
  • Size: 5.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for compas_occt-0.1.17.tar.gz
Algorithm Hash digest
SHA256 43a7fc35675f6536eea6181b7751503e11c364121ac2634b708c1f3f7061ea25
MD5 88c4fbae14f6b75f69872ad0a2be7ff4
BLAKE2b-256 c1e9c5de39d405528184dc54c870c6281557051881719de169c38d496ab0b81d

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_occt-0.1.17.tar.gz:

Publisher: release.yml on petrasvestartas/compas_occt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_occt-0.1.17-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: compas_occt-0.1.17-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 10.4 MB
  • Tags: CPython 3.12+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for compas_occt-0.1.17-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f03adad1fc5fb218441131d0310f3f8ca0cd617288783e193283c8769574019b
MD5 872923958e778680882388ee81dd0627
BLAKE2b-256 80419fa55f2b6af25c0703437732cbcb085bc60d7fdeb925b1f302621dec8ae4

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_occt-0.1.17-cp312-abi3-win_amd64.whl:

Publisher: release.yml on petrasvestartas/compas_occt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_occt-0.1.17-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for compas_occt-0.1.17-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ada7126427f7d2dc38fa524bc50f7854850fe62d21210a900aa9cb839e12f21a
MD5 9d6d5be91b53ee46f8b533305b0b5959
BLAKE2b-256 f7c0c20ebf92b6b2c167d275dede7acad0b067b9234f11a3a2422071b0e03b22

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_occt-0.1.17-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on petrasvestartas/compas_occt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_occt-0.1.17-cp312-abi3-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for compas_occt-0.1.17-cp312-abi3-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 372c1362c6be615c5335ebdb617650bf023492d3797591241b05309faefe6692
MD5 c307def6b4a02932e95232f9e2d09cc1
BLAKE2b-256 d66580e42753c75d85f3d28f4f81b00d74640cc24c76a23204c1164459e7071a

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_occt-0.1.17-cp312-abi3-macosx_11_0_x86_64.whl:

Publisher: release.yml on petrasvestartas/compas_occt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_occt-0.1.17-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for compas_occt-0.1.17-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 56fb988beb2dbd4915b0fd588e5240f505f315721ef73c018c4770b419ae23a4
MD5 0bb81f171399656806eb1879660625dc
BLAKE2b-256 3358cc25df1cae675952614945be167097f5f7ed3a293956bc3bbc945d568597

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_occt-0.1.17-cp312-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on petrasvestartas/compas_occt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_occt-0.1.17-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for compas_occt-0.1.17-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0a1049631eefaed399ef806866597a5307499439d233d3004a86fac96489f43c
MD5 4c161bdff51f9a7121fa729e434869a3
BLAKE2b-256 7a7288ea1110b1ee0b4097cc67bb86e78ad616ef92e84eea440a0b3c8feb9eff

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_occt-0.1.17-cp311-cp311-win_amd64.whl:

Publisher: release.yml on petrasvestartas/compas_occt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_occt-0.1.17-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for compas_occt-0.1.17-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 64d215c42aaae4038baaea0762cbae53f835f0410721a8f8f796a7a79374e0f2
MD5 5cd73019aac4fd2079c40e48bdb4379e
BLAKE2b-256 03581209311d96f6b9573f0da887649a1bd37ad55b529d2a12ab4071098ae092

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_occt-0.1.17-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on petrasvestartas/compas_occt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_occt-0.1.17-cp311-cp311-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for compas_occt-0.1.17-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 9ff0b92c17318e70738262d25355653c6398dd48315aa65fe2b8bfe56a41a722
MD5 321126aeae939310038a71c4a01e71d0
BLAKE2b-256 6020bc535e707d850e175f221097c7c3a0898d8d3bde908156e8ff4d50dd3694

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_occt-0.1.17-cp311-cp311-macosx_11_0_x86_64.whl:

Publisher: release.yml on petrasvestartas/compas_occt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_occt-0.1.17-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for compas_occt-0.1.17-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 12520c13df65379b8e4f2e7e3acdc05493735400c6b9e9bd71eab0e14820a1c9
MD5 9e116b849dd9bc9be33e884694f322bb
BLAKE2b-256 3025ca847b6804ba83a703dbaccfe544c79e0375c11caaa1ff2df1aaf0f6fee1

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_occt-0.1.17-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on petrasvestartas/compas_occt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_occt-0.1.17-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for compas_occt-0.1.17-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1da9c0e69cb0ae5cebbfd60fdfa544e604948ff982b5d82eae0a6032faee7c2b
MD5 c0f0e89cedfb51fa2d8c347b80e8c817
BLAKE2b-256 92e7635455270a29cbed67916882130ddc112de74aef198a7c22c6e2f37feb44

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_occt-0.1.17-cp310-cp310-win_amd64.whl:

Publisher: release.yml on petrasvestartas/compas_occt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_occt-0.1.17-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for compas_occt-0.1.17-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8185ee0911cd0dc0f1c403f0acf60def8bd8e43a09e69d389cbecc974320c23b
MD5 06f81a159e54cfa2c2042f24e637d148
BLAKE2b-256 280b4200af9f5eb7d077c55d7a78452cc1953be2dcbccfa87a54ac75f9b5d79c

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_occt-0.1.17-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on petrasvestartas/compas_occt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_occt-0.1.17-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for compas_occt-0.1.17-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 68c86a6cc299797991242fe2972c181eb033b2978fdfacdfb96df4f9bf4cadc3
MD5 01f7aebbaac2389eb93b0ac89826cd79
BLAKE2b-256 64b31e25191c0eeeecb4f16931fb9acf25d9845b1f4037e9d615ac69bc893a5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_occt-0.1.17-cp310-cp310-macosx_11_0_x86_64.whl:

Publisher: release.yml on petrasvestartas/compas_occt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_occt-0.1.17-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for compas_occt-0.1.17-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d832cfce72831cf8281e412770f21599f1f8ff8496d9d2d31487ef00edea63d5
MD5 562ca8ef641e4c8f8992b8ede454b766
BLAKE2b-256 21065889ddc87cfc09ca70bffd33d564a2a9e7b91b4af6d787891750805361b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_occt-0.1.17-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: release.yml on petrasvestartas/compas_occt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_occt-0.1.17-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: compas_occt-0.1.17-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 10.4 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for compas_occt-0.1.17-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 58fdd5079cb97060be73c342d881860204e800dc3cd1d6a2f6b9c8db2fe2275b
MD5 a53e6c610693477e5cba444509756dfa
BLAKE2b-256 cfa4ebc2889815a18dc484dfa9488aff1f15a9f28c3fda80b8ecf021c7681b70

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_occt-0.1.17-cp39-cp39-win_amd64.whl:

Publisher: release.yml on petrasvestartas/compas_occt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_occt-0.1.17-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for compas_occt-0.1.17-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8a7f3997ccf24b12b48e81fe8aa4dbbec99676cfdf4b6ad9838b5d300cef9db4
MD5 96e2d783776b88c8a2a5209b3e3c5e8e
BLAKE2b-256 9935fd42a037dcdef5354d67b659329f8bc2d36770858bf0b90bf22d3d2ace68

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_occt-0.1.17-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on petrasvestartas/compas_occt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_occt-0.1.17-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for compas_occt-0.1.17-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 10185e20a0952cd6f55b3f20c31b020ce0d8ad8a2cc2ae189af2e73caf9fae0f
MD5 4a47bf1e21b8ca8512f2d6bf5dd3d4e1
BLAKE2b-256 bcf83467c57d8b10ae76d3dd56280f822172cc351a01795ea3078511a218fb70

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_occt-0.1.17-cp39-cp39-macosx_11_0_x86_64.whl:

Publisher: release.yml on petrasvestartas/compas_occt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_occt-0.1.17-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for compas_occt-0.1.17-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8176cbb99e3e6bc569c6cd294733c685d30a2346eb4c2ffa825e2d398b5371cf
MD5 f5f8b53753e24c900b99afea613dc18b
BLAKE2b-256 00a0ea68fc127a584b0955021ebff9f90ed9dcbe4d01bbb6120cfee4d50e5f98

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_occt-0.1.17-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: release.yml on petrasvestartas/compas_occt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page