Crates.io | kcl-lib |
lib.rs | kcl-lib |
version | 0.2.93 |
created_at | 2023-08-29 01:25:56.828004+00 |
updated_at | 2025-08-20 16:59:57.07968+00 |
description | KittyCAD Language implementation and tools |
homepage | |
repository | https://github.com/KittyCAD/modeling-app |
max_upload_size | |
id | 957507 |
size | 2,959,445 |
Our language for defining geometry and working with our Geometry Engine efficiently. Short for KittyCAD Language, named after our Design API.
We've built a lot of tooling to make contributing to KCL easier. If you are interested in contributing a new standard library function to KCL, here is the rough process:
./kcl/src/std
and place your new one near it or in the same category file.pub async
of the actual standard library function in Ruststdlib
macro providing the name that will need to be written by KCL users to use the function (this is usually a camelCase version of your Rust implementation, which is named with snake_case)export KITTYCAD_API_TOKEN=your-token-here
in a terminalTWENTY_TWENTY=overwrite cargo nextest run --workspace --no-fail-fast
to take snapshot tests of your example code running in the enginejust redo-kcl-stdlib-docs
to generate new Markdown documentation for your function that will be used to generate docs on our website.If you have KCL code that you want to test, simulation tests are the preferred way to do that.
Make a new sim test. Replace foo_bar
with the snake case name of your test. The name needs to be unique.
just new-sim-test foo_bar
It will show the commands it ran, including the path to a new file foo_bar/input.kcl
. Edit that with your KCL. If you need additional KCL files to import, include them in this directory.
Then run it.
just overwrite-sim-test foo_bar
The above should create a bunch of output files in the same directory.
Make sure you actually look at them. Specifically, if there's an execution_error.snap
, it means the execution failed. Depending on the test, this may be what you expect. But if it's not, delete the snap file and run it again.
When it looks good, commit all the files, including input.kcl
, generated output files in the test directory, and changes to simulation_tests.rs
.
If you bump the version of kcl-lib and push it to crates, be sure to update the repos we own that use it as well. These are: