Skip to main content
Loss of provenance

A previous release had provenance metadata, but this release does not. View details.

Kerf

An open, engine-independent IR for the mesh → G-code half of 3D printing — with a written-down denotational semantics and a lowering whose correctness is mechanically checked.

Think "LLVM for slicing," but the point is the verifier, not the container.

Slicers (Cura, PrusaSlicer, OrcaSlicer) are compilers: they lower geometry into machine code (G-code), but each buries that machinery in a private codebase, and no mainstream slicer can show its output corresponds to the input. Kerf is the open middle: an IR whose meaning is defined (denote = the material a program deposits), a lowering Kerf owns, and an oracle that checks the lowering preserves that meaning. Today it mostly consumes slicer G-code to verify it.

Install

# CLI (the `kerf` binary)
cargo install kerf-cli

# Python (CPython ≥ 3.12)
pip install pykerf

Quickstart

# Verify: do Kerf's operations preserve this print?
kerf verify part.gcode              # exit 0 sound · 1 unsound · 3 nothing to verify

# Diff: do two slicers / settings make the same part?
kerf diff old.gcode new.gcode       # exit 0 identical · 1 differ

# Inspect: what did the parser recover, guess, or drop?
kerf inspect part.gcode
import json, pykerf
r = json.loads(pykerf.verify_gcode(open("part.gcode").read()))
assert r["has_geometry"] and r["pass_preserves_denotation"] and r["translation_invariant"]

What it does

  • Two-level IR — hi (geometric regions) and lo (move plan), joined by a lowering Kerf owns.
  • denote — reference semantics: a program's deposited material as conservative raster occupancy, reversal-invariant.
  • Soundness oracle — checks the lowering and each optimization pass preserve denote; a negative test confirms a material-dropping pass is rejected.
  • G-code frontend — parses real Cura / PrusaSlicer / OrcaSlicer / Bambu / Simplify3D / KISSlicer / ideaMaker / Slic3r output, including arc (G2/G3) flattening; never panics on untrusted input.
  • kerf verify / kerf diff — verification and material comparison over real parsed geometry, with CI-friendly exit codes.
  • Proofs — P1–P4 proved in Lean 4 (no sorry); load-bearing kernels model-checked with Kani.

Limitations

  • Resolution-bounded. denote compares material up to the raster resolution; choose --resolution ≤ your smallest feature. Sub-resolution differences are not distinguished.
  • Planar only. 2D-per-layer IR; non-planar / vase mode is out of scope.
  • Deposited geometry, not process state. Widths without a ;WIDTH: comment are estimated; feature roles are an untrusted re-inference. The lo→G-code emitter is lossy and sits outside the verified boundary.
  • Checked oracle, not an end-to-end proof. A semantics-level mechanized proof over exact geometry is future work.

Repository

crates/kerf-core   IR, lowering, denote, passes, G-code frontend, verify/diff
crates/kerf-cli    the `kerf` binary
crates/kerf-py     PyO3 bindings (published to PyPI as pykerf)
proofs/            Lean 4 proofs of P1–P4
docs/              design record and semantics

The full design rationale, prior-art scoping, and semantics live in docs/ — start with docs/00-thesis.md and docs/08-semantics.md.

License

Dual-licensed under MIT or Apache-2.0, at your option.

Metadata

Release files for pykerf 0.10.0

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

Loss of provenance

These files do not have provenance metadata, despite files in a prior release including this data.

We recommend further investigation before installing these files. View details.

Source distribution (sdist)

Source distribution for pykerf 0.10.0
File Size Uploaded Provenance Actions
pykerf-0.10.0.tar.gz 103.5 kB Without provenance Details for pykerf-0.10.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pykerf 0.10.0
File Interpreter ABI Platform Actions
pykerf-0.10.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for pykerf-0.10.0-cp312-abi3-win_amd64.whl
pykerf-0.10.0-cp312-abi3-manylinux_2_34_x86_64.whl CPython 3.12 abi3 Linux glibc 2.34+ x86-64 Details for pykerf-0.10.0-cp312-abi3-manylinux_2_34_x86_64.whl
pykerf-0.10.0-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for pykerf-0.10.0-cp312-abi3-macosx_11_0_arm64.whl

Total release size: 2.1 MB

Release files / pykerf-0.10.0.tar.gz

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL pykerf-0.10.0.tar.gz
Size 103.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9390c89462b22c194aa61370b37531f21a3d5665c230110d88539b1ba6981cf9
BLAKE2b-256 checksum
How to use checksums
7aa12d5bb4e04a7c2318c5c83f83377bc09147d9892aeac3c382d6a81611af2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pykerf-0.10.0-cp312-abi3-win_amd64.whl

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL pykerf-0.10.0-cp312-abi3-win_amd64.whl
Size 575.3 kB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
ed71508c4e4747c42c9cdec93502d4ae9f6a4db96c696ca95607e744cf04622c
BLAKE2b-256 checksum
How to use checksums
a3b451ca02b8034e30b9bb0426384fa1d1b8fd78f3e2f6608a389c7c7880ddbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pykerf-0.10.0-cp312-abi3-manylinux_2_34_x86_64.whl

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL pykerf-0.10.0-cp312-abi3-manylinux_2_34_x86_64.whl
Size 748.1 kB
Tags CPython 3.12 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
5c6da2eee81a8099323e2e7752e491c09d6a77573ea27fd41a68278bf725f242
BLAKE2b-256 checksum
How to use checksums
c34cc090150df6d86506a059ecc51f4109f75264b9f1251f45621db05b737dd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / pykerf-0.10.0-cp312-abi3-macosx_11_0_arm64.whl

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL pykerf-0.10.0-cp312-abi3-macosx_11_0_arm64.whl
Size 658.4 kB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
5f52654551805fe8828dbcdc7d783bb9bf9192e178aa55a37d6508f3cc2f6bf9
BLAKE2b-256 checksum
How to use checksums
f6869e5a7254449192b7157c6504b0235cd71190942bfd8588f45e4cc9949067
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Security for pykerf 0.10.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.

Loss of provenance

A previous release of these files had provenance metadata, but this release does not.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Release comparison

  • Removed 0.2.0 3 files With provenance
  • Added 0.10.0 4 files Without provenance

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