Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
Signed-off-by: Jess Frazelle <github@jessfraz.com>
  • Loading branch information
jessfraz committed Jun 19, 2024
1 parent 83e612a commit e3722df
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zoo-kcl"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
repository = "https://github.com/kittycad/kcl.py"

Expand Down
Empty file added files/lego.kcl
Empty file.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,15 @@ fn lint(code: String) -> PyResult<Vec<Discovered>> {
/// The kcl python module.
#[pymodule]
fn kcl(m: &Bound<'_, PyModule>) -> PyResult<()> {
// Add our types to the module.
m.add_class::<ImageFormat>()?;
m.add_class::<ExportFile>()?;
m.add_class::<FileExportFormat>()?;
m.add_class::<UnitLength>()?;
m.add_class::<FormatOptions>()?;
m.add_class::<Discovered>()?;

// Add our functions to the module.
m.add_function(wrap_pyfunction!(execute_and_snapshot, m)?)?;
m.add_function(wrap_pyfunction!(execute_and_export, m)?)?;
m.add_function(wrap_pyfunction!(format, m)?)?;
Expand Down
17 changes: 17 additions & 0 deletions tests/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env python3
import os

import kcl

# Get the path to this script's parent directory.
kcl_dir_file_path = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "..", "files"
)


def test_kcl_execute_and_snapshot():
# Read from a file.
with open(os.path.join(kcl_dir_file_path, "lego.kcl"), "w") as f:
image_bytes = kcl.execute_and_snapshot(str(f), kcl.UnitLength, 'jpeg')
assert image_bytes is not None
assert len(image_bytes) > 0

0 comments on commit e3722df

Please sign in to comment.