{"id":8895,"library":"chialisp","title":"Chialisp Python Tools","description":"A pure Python implementation of Chialisp tools, including the CLVM (Chia's Lisp Virtual Machine), compiler, and standard library. It provides utilities for assembling and disassembling Chialisp programs, and interfaces with `clvm_tools_rs` for performance. Currently at version 0.4.3, its release cadence is tied to updates in the broader Chia ecosystem and CLVM specification.","status":"active","version":"0.4.3","language":"en","source_language":"en","source_url":"https://github.com/Chia-Network/chialisp-py","tags":["chialisp","chia","blockchain","clvm","compiler","assembler"],"install":[{"cmd":"pip install chialisp","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Provides core CLVM compilation, assembly, and disassembly functionality, implemented in Rust for performance. This package is a wrapper around it.","package":"clvm_tools_rs","optional":false}],"imports":[{"symbol":"assemble","correct":"from chialisp.clvm_tools.binutils import assemble"},{"symbol":"disassembler","correct":"from chialisp.clvm_tools.binutils import disassembler"},{"note":"Primarily used for compiling Chialisp files (modules) rather than simple expressions. Expects file paths as arguments.","symbol":"compile_clvm","correct":"from chialisp.clvm_tools.clvmc import compile_clvm"}],"quickstart":{"code":"from chialisp.clvm_tools.binutils import assemble, disassembler\n\n# Chialisp source code\nchialisp_source = \"(a (q 2 2) (q 1 3))\"\n\n# 1. Assemble Chialisp source into a CLVM program (bytes)\nprint(f\"Original Chialisp source: {chialisp_source}\")\nassembled_program = assemble(chialisp_source)\nprint(f\"Assembled CLVM program (bytes): {assembled_program.hex()}\")\n\n# 2. Disassemble a CLVM program back into Chialisp source (approximate)\ndisassembled_source = disassembler(assembled_program)\nprint(f\"Disassembled Chialisp source: {disassembled_source}\")\n\n# Example with a slightly more complex structure\ncomplex_source = \"(a (q . 1) (q (a (q 2 2) (q 1 3)) (c (q 5) (q 1))))\"\nassembled_complex = assemble(complex_source)\nprint(f\"\\nComplex Chialisp source: {complex_source}\")\nprint(f\"Assembled complex program (bytes): {assembled_complex.hex()}\")\nprint(f\"Disassembled complex program: {disassembler(assembled_complex)}\")","lang":"python","description":"This quickstart demonstrates the core functionality of `chialisp` for assembling Chialisp source code into CLVM byte representations and disassembling CLVM bytes back into human-readable Chialisp. It uses the `assemble` and `disassembler` functions from `chialisp.clvm_tools.binutils`."},"warnings":[{"fix":"Ensure you have a Rust toolchain (compiler and Cargo) installed before attempting to `pip install chialisp`. Refer to `rustup.rs` for installation instructions.","message":"Installation may fail if pre-compiled wheels for the `clvm_tools_rs` dependency are not available for your platform and a Rust toolchain is not installed on your system.","severity":"gotcha","affected_versions":"0.4.0+"},{"fix":"Always test Chialisp programs with the specific `chialisp` library version intended for deployment. Consult Chia-Network documentation for CLVM specification changes.","message":"The interpretation and compilation of Chialisp programs can change between versions due to updates in the underlying CLVM specification or compiler logic.","severity":"gotcha","affected_versions":"All versions, especially across major `chialisp` or `clvm_tools_rs` updates."},{"fix":"Always import compiler and assembly utilities from `chialisp.clvm_tools` (e.g., `from chialisp.clvm_tools.binutils import assemble`).","message":"While `chialisp` depends on `clvm_tools_rs`, its core functionalities are exposed through the `chialisp.clvm_tools` namespace. Direct imports from `clvm_tools_rs` are generally not intended for external use and may lead to unexpected behavior or API instability.","severity":"gotcha","affected_versions":"0.4.0+"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Install Rust and Cargo using `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh` (Linux/macOS) or download from `rustup.rs`. Ensure Rust is in your system's PATH.","cause":"The underlying `clvm_tools_rs` Rust package could not be compiled because a Rust toolchain (compiler, cargo) is missing or misconfigured on your system.","error":"ERROR: Could not build wheels for clvm-tools-rs, which is required to install pyproject.toml-based projects"},{"fix":"Ensure `chialisp` is installed with `pip install chialisp`. Verify that your Python environment is active and the import statement matches official documentation.","cause":"The `chialisp` package is not installed in your current environment, or the import path is incorrect (e.g., a typo in `binutils`).","error":"ModuleNotFoundError: No module named 'chialisp.clvm_tools.binutils'"},{"fix":"Review the Chialisp program for correct syntax, valid opcodes, and appropriate atom encoding. Consult the official Chialisp documentation for syntax rules and examples.","cause":"Invalid Chialisp syntax, incorrect data types, or a malformed expression provided to `assemble` or `compile_clvm`.","error":"Error: Bad encoding for atom 2 2"}]}