Skip to content

Python bindings to the rust kcl-lib crate.

License

Notifications You must be signed in to change notification settings

KittyCAD/kcl.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kcl.py

Python bindings to the rust kcl-lib crate.

Usage

The tests.py file contains examples of how to use the library.

Development

We use maturin for this project.

You can either download binaries from the latest release or install it with pipx:

pipx install maturin

Note

pip install maturin should also work if you don't want to use pipx.

There are four main commands:

  • maturin publish builds the crate into python packages and publishes them to pypi.
  • maturin build builds the wheels and stores them in a folder (target/wheels by default), but doesn't upload them. It's possible to upload those with twine or maturin upload.
  • maturin develop builds the crate and installs it as a python module directly in the current virtualenv. Note that while maturin develop is faster, it doesn't support all the feature that running pip install after maturin build supports.

pyo3 bindings are automatically detected. maturin doesn't need extra configuration files and doesn't clash with an existing setuptools-rust or milksnake configuration.

Releasing a new version

  1. Make sure the Cargo.toml has the new version you want to release.
  2. Run make tag this is just an easy command for making a tag formatted correctly with the version.
  3. Push the tag (the result of make tag gives instructions for this)
  4. Everything else is triggered from the tag push. Just make sure all the tests pass on the main branch before making and pushing a new tag.