Chialisp Builder

raw JSON →
0.1.2 verified Fri May 01 auth: no python

A Python tool for building Chialisp programs with recursive dependency resolution. Version 0.1.2 is the latest stable release. The library automatically identifies and includes dependencies when compiling .clsp files to .hex, maintaining compatibility with Chia's smart contract ecosystem.

pip install chialisp-builder
error ModuleNotFoundError: No module named 'chialisp_builder'
cause Package not installed or wrong import name (hyphen vs underscore).
fix
Install with 'pip install chialisp-builder' and import using 'import chialisp_builder', not 'import chialisp-builder'.
error TypeError: build() takes 1 positional argument but 2 were given
cause Passing extra arguments to the build() function.
fix
Call build() with only the file path: build('my_contract.clsp').
error FileNotFoundError: [Errno 2] No such file or directory: '...'
cause The provided file path does not exist or is relative to a different directory.
fix
Use an absolute path or ensure the working directory matches.
gotcha The build() function does not validate the Chialisp syntax; it only resolves dependencies and concatenates include files. Compilation errors may only surface when using a separate clvm compiler.
fix Use the output .hex with a validator (e.g., clvm_tools) to check correctness.
gotcha The builder may not handle circular dependencies gracefully; infinite recursion is possible. Ensure your include chain is acyclic.
fix Manually audit your include statements to avoid cycles.
breaking The function signature of build() expects a single file path argument; passing multiple files or additional arguments will raise a TypeError.
fix Call build() once per file, or iterate over a list of files.

This quickstart demonstrates the primary use case: compiling a .clsp file to hex with automatic dependency resolution.

from chialisp_builder import build

# Build a Chialisp file and its dependencies
# The builder automatically resolves and includes recursive dependencies
result = build('path/to/smart_contract.clsp')
print(result.hex)  # Compiled hex output
print(result.includes)  # List of included dependency files