Skip to main content

pykentron

Python bindings for kentron, with a CadQuery-compatible API, so that CadQuery scripts run on kentron unchanged.

Installing

pip install pykentron              # the kernel and pykentron's own CadQuery-like API
pip install "pykentron[cadquery]"  # also what CadQuery's own layers need, to run CadQuery scripts

Python 3.10 or later. The wheels on PyPI are built for Linux (x86-64-v2: Intel from 2008, AMD from 2011; and ARM64), macOS (ARM64 and x86-64) and Windows (x86-64); on an older x86-64 machine build from source with an empty RUSTFLAGS=.

Using it

import pykentron as cq
box = cq.Workplane("XY").box(10, 20, 30).faces(">Z").workplane().hole(5)
print(box.val().Volume())

To run CadQuery scripts unchanged, import pykentron.shim first: import cadquery then gives CadQuery's own pure-Python layers (Workplane, Sketch, selectors, cqgi, free functions, assemblies: copied unchanged from CadQuery v2.8.0, Apache-2.0, see pykentron/cadquery_shim/cadquery/VENDORED.txt) on pykentron's shapes. Or run a script as it is with pykentron-run script.py. Nothing named cadquery is installed, so a real CadQuery beside pykentron is unaffected unless the shim is activated (the two cannot share one process).

Code written against OCP, as libraries like cq_warehouse are, finds some of OCCT's names:

  • Shape.wrapped answers TopoDS_Shape's Moved, Located, Location (also placing the shape in place), Orientation, Oriented, Reversed, ShapeType, IsSame, IsEqual, IsPartner, IsNull;
  • Vector.wrapped answers gp_Vec's methods, Location.wrapped IsEqual and Transformation, and Matrix.wrapped Trsf();
  • the classes BRepBuilderAPI_Copy, BRepBuilderAPI_Transform, BRepBuilderAPI_Sewing, BRepBuilderAPI_MakeFace (a face from a planar wire, or a face with holes added), ShapeUpgrade_UnifySameDomain, Bnd_Box with BRepBndLib.AddOptimal_s, BRepTools.UVBounds_s and Clean_s, the empty TopoDS_Shape(), the TopAbs numbers and the gp classes;
  • projections and fillings: BRepProj_Projection (wires onto shapes, along a direction or from a point), BRepOffsetAPI_MakeFilling (faces spanning a loop of edges through points: the plate of least bending energy, as Face.makeNSidedSurface and interpPlate make), BRepOffset_MakeOffset (thickening a face into a solid), BRepIntCurveSurface_Inter with gce_MakeLin (where a line crosses a shape's faces), ShapeAnalysis_FreeBounds' ConnectEdgesToWires_s with TopTools_HSequenceOfShape, GeomAPI_IntSS (on the faces BRepAdaptor_Surface stands for), BRepBuilderAPI_MakeEdge and MakeWire, TopoDS' casts, ShapeFix_Face (keeping the face), and StdFail_NotDone (as ValueError, what kentron's failures raise);
  • occ_impl.shapes' downcast, fix and shapetype.

Other names, of pykentron or OCP, import but raise NotImplementedError when used.

Building from source

pip install ./crates/pykentron                 # with maturin, as the PyPI wheels are built
python3 crates/pykentron/build.py              # in place, optimized (LTO), into python/pykentron/_kentron.abi3.so
python3 crates/pykentron/build.py --quick      # in place, the tests' release profile

The in-place build installs the extension by renaming, so interpreters that have it loaded keep running; put crates/pykentron/python on sys.path to use it. The CadQuery layers need pyparsing, multimethod, runtype, typing_extensions and numpy, as CadQuery does: the cadquery extra. CadQuery's assembly and sketch constraints are solved by kentron, without casadi or nlopt, step for step as CadQuery's solvers take them (IPOPT's Newton steps for assemblies, nlopt's SLSQP on CadQuery's own costs for sketches), so that parts and sketches the constraints leave free to move end where CadQuery's do. PYKENTRON_SOLVER=cadquery uses CadQuery's own solvers instead (the cadquery-solvers extra).

Memory and speed

Shapes no Python object refers to any more are collected from time to time, with the values cached for them. Which allocator kentron's memory comes from is a profile, chosen by PYKENTRON_PROFILE before pykentron is imported:

profile allocator a complex five-part CadQuery model
low-memory the system's 281 MB at the peak, 4.2 s
fast (default) mimalloc 136% of the peak memory, ~16% faster

pykentron.profile() gives the profile in use. The allocator is chosen once, at startup, so the profile is only had through the variable (pykentron.set_profile(name) accepts only the profile in use). balanced, a profile once between the two, is read as low-memory. Building without the mimalloc feature (cargo build -p pykentron --no-default-features) drops mimalloc and the fast profile (low-memory is then the default).

What is there

  • Workplane: sketching (polylines, lines, arcs, rectangles, circles, polygons, points, workplanes and transforms), extrude/cutBlind/revolve/box/cylinder, booleans, fillet, selection (faces, edges, ... with string selectors |, #, +, -, <, >, %TYPE), placement.
  • Shapes (Vertex, Edge, Wire, Face, Shell, Solid, Compound): construction (boxes, cylinders, cones, spheres, tori, prisms, revolutions, lofts, offset2D, shell offsets and thick solids), booleans, clean, transforms and mirrors, queries (volume, area, length, centres, bounding boxes, validity, normals, geometry types, distance, isInside, tessellate). As in CadQuery, a shape's bounding box is tight until it is tessellated, then bounded by its meshes, widened by their deviation.
  • Files: STEP import and export (shapes, or an Assembly with names, colours and placements), OCAF documents, binary (XBF) and XML (an Assembly, its sub-shapes' names, colours and layers too, read and written as CadQuery's), BRep import and export (OCCT's binary BRep too), STL export.
  • Splines: interpolated, approximated (makeSplineApprox, smoothed too, as parametricCurve makes them), Bézier.
  • Assembly, Location, Plane, Vector, Color (by OCCT's colour names, which are X11's), BoundBox.

Not yet: DXF import, SVG and other exporters, cadquery.vis.show (warns).

Checking it

  • tests/test_against_cadquery.py compares pykentron with the real CadQuery case by case (run it with a Python that has CadQuery: PYTHON crates/pykentron/tests/test_against_cadquery.py).
  • scripts/cadquery_build.py --project DIR MODULE runs a CadQuery project's build() on pykentron and reports each part's volume, faces and validity; --oracle runs it on CadQuery instead.
  • scripts/cadquery_sweep.py --project DIR --python PYTHON builds every module of a project both ways and checks that each part is valid and within 0.1% of CadQuery's volume (--oracle-cache FILE keeps CadQuery's results, which do not change).
  • scripts/cadquery_tests.py runs CadQuery's own test suite (release v2.8.0, fetched from GitHub into target/cadquery-tests with a virtual environment of its own, made with uv) against pykentron, unchanged: python3 crates/pykentron/scripts/cadquery_tests.py [pytest arguments]. It fails on any test failing that is not in tests/cadquery_baseline.txt and reports those of the baseline that pass; --update-baseline records the current failures. Tests of OCCT's own ways rather than CadQuery's behaviour are left out (tests/cadquery_excluded.txt, each with its reason). The suite reaches CadQuery's internals (cadquery.occ_impl.*, cadquery.func, OCP): the shim resolves those names to pykentron's where it has them, and makes the rest placeholders that raise NotImplementedError when used.
  • tests/found/ holds CadQuery scripts from public projects that pykentron failed on, built differently from CadQuery, or built much more slowly, with where each came from and what went wrong (cases.tsv), and the tools that found them (harness/: each script run on both, in fresh isolated processes, and compared).

Metadata

Release files for pykentron 0.19.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 pykentron 0.19.0
File Size Uploaded Provenance Actions
pykentron-0.19.0.tar.gz 4.3 MB With provenance Details for pykentron-0.19.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pykentron 0.19.0
File Actions
pykentron-0.19.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for pykentron-0.19.0-cp310-abi3-win_amd64.whl
pykentron-0.19.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for pykentron-0.19.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
pykentron-0.19.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for pykentron-0.19.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
pykentron-0.19.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for pykentron-0.19.0-cp310-abi3-macosx_11_0_arm64.whl
pykentron-0.19.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for pykentron-0.19.0-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 30.3 MB

Release files / pykentron-0.19.0.tar.gz

Download URL pykentron-0.19.0.tar.gz
Size 4.3 MB
Tags Source
SHA-256 checksum
How to use checksums
ecfc3302341e97b9ae0ad80935af1a5b40798f521cc715f8b78e56eca3253b80
BLAKE2b-256 checksum
How to use checksums
1b6b5fd8f2aaf5489b00e56f1e1ad71eae4b777d0b7907ad435614f3eb718c0f
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 18, 2026.

Transparency log

Release files / pykentron-0.19.0-cp310-abi3-win_amd64.whl

Download URL pykentron-0.19.0-cp310-abi3-win_amd64.whl
Size 5.3 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
f5331288f9917c2273ea84cfd8479b9c9689f754977fb7af61e5f851b15af826
BLAKE2b-256 checksum
How to use checksums
fc141635ea1a274c551a9fdba3070df0aa3e98f5633cc9d23a2eae59da5cf6f2
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 18, 2026.

Transparency log

Release files / pykentron-0.19.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL pykentron-0.19.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 5.6 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
a7f609a82012e29a7bd58a4802d96c2670787ce8df8f87946b6a7ba6d2d2466d
BLAKE2b-256 checksum
How to use checksums
fcf2c192dafd083a5b887fb75f81c35b4eabf73f886a8f6a790c79aedafa4adb
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 18, 2026.

Transparency log

Release files / pykentron-0.19.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL pykentron-0.19.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 5.2 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
e8dc0c41be30f853b4102318c2529e2b2393cb8c7d822681137e91f64072fc83
BLAKE2b-256 checksum
How to use checksums
65f48ce252d68db2d87fb88bb8e10828212d65fcb0ec5dbab9380280fa68596c
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 18, 2026.

Transparency log

Release files / pykentron-0.19.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL pykentron-0.19.0-cp310-abi3-macosx_11_0_arm64.whl
Size 5.0 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
be907097c934558b2a6b97c1b666514c40dc25751def3c831cef5d4aacc5bbe4
BLAKE2b-256 checksum
How to use checksums
7468704d5d75b9438dcb1688c24d64e726a985b9e171de3a468e710d1b14374a
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 18, 2026.

Transparency log

Release files / pykentron-0.19.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL pykentron-0.19.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 4.9 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
171bc7931c45e822898655223a529144440ef80a2ad433991cb64b70d636fc8c
BLAKE2b-256 checksum
How to use checksums
0d6264b4e6daef24be2188711046be2f33d6ad82de1b8324878aedd8359480db
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 18, 2026.

Transparency log

Security for pykentron 0.19.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

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for pykentron-0.19.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 18, 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