{"id":6568,"library":"clvm-tools-rs","title":"CLVM Tools Rust","description":"clvm-tools-rs provides a Rust implementation of tools for working with the Chialisp language, including a compiler and REPL, with Python and WebAssembly (WASM) bindings. It is a port of the original clvm_tools to Rust, aiming for improved performance and better alignment with the underlying clvm_rs Rust implementation. The library is actively developed, with its core Rust components seeing frequent updates.","status":"active","version":"0.4.0","language":"en","source_language":"en","source_url":"https://github.com/Chia-Network/clvm_tools_rs","tags":["chialisp","clvm","chia","compiler","blockchain","rust-bindings"],"install":[{"cmd":"pip install clvm-tools-rs","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"symbol":"compile_clvm","correct":"from clvm_tools_rs import compile_clvm"}],"quickstart":{"code":"import os\nfrom pathlib import Path\nfrom clvm_tools_rs import compile_clvm\n\n# Create a dummy Chialisp file\nchialisp_code = \"\"\" (mod (A B)\n    (+ A B)\n) \"\"\"\n\n# Ensure a temporary directory exists for the output\noutput_dir = Path(\"temp_chialisp_output\")\noutput_dir.mkdir(exist_ok=True)\n\nchialisp_file_path = output_dir / \"my_program.clsp\"\ncompiled_file_path = output_dir / \"my_program.clvm.hex\"\n\nwith open(chialisp_file_path, \"w\") as f:\n    f.write(chialisp_code)\n\n# Compile the Chialisp code\n# The compile_clvm function expects strings for paths\ncompile_result = compile_clvm(str(chialisp_file_path), str(compiled_file_path), [], False)\n\nprint(f\"Compiled successfully: {compile_result['success']}\")\nif compile_result['success']:\n    print(f\"Output CLVM hex written to: {compiled_file_path}\")\n    with open(compiled_file_path, \"r\") as f:\n        print(f\"Compiled CLVM (hex): {f.read().strip()}\")\nelse:\n    print(f\"Compilation error: {compile_result['error']}\")\n\n# Clean up temporary files (optional)\n# os.remove(chialisp_file_path)\n# os.remove(compiled_file_path)\n# os.rmdir(output_dir)","lang":"python","description":"This quickstart demonstrates how to use `compile_clvm` from `clvm_tools_rs` to compile a Chialisp source file into its CLVM hexadecimal representation. It creates a simple Chialisp program, compiles it, and prints the result."},"warnings":[{"fix":"If you require all Rust-based command-line tools, consider installing `clvm-tools-rs` via `cargo install clvm_tools_rs` from the source repository. For Python-centric development, `pip install` is sufficient, and the core `compile_clvm` function will be available.","message":"The `pip install clvm-tools-rs` command installs Python bindings that provide a subset of the command-line tools available when installing via `cargo install clvm_tools_rs`. Specifically, `pip` provides `brun`, `run`, `opc`, and `opd` functionality through Python imports, but other Rust-specific CLI tools might not be exposed this way.","severity":"gotcha","affected_versions":"0.4.0 and earlier"},{"fix":"Always use `from clvm_tools_rs import ...` for the Python bindings of the Rust port. Avoid `import clvm_tools` unless you specifically intend to use the legacy Python-only version.","message":"There are several related packages: `clvm-tools` (older Python implementation), `clvm-tools-rs` (Rust port with Python bindings), and `clvm_rs` (the underlying Rust CLVM implementation). Ensure you are importing from `clvm_tools_rs` for the Rust-backed Python bindings, as `clvm-tools` is a distinct, older package and `clvm_rs` is the Rust crate name, not the Python package import path.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If encountering build errors on M1 Macs, refer to the official `clvm-tools-rs` GitHub repository for specific build instructions, which may include using `cargo build --no-default-features`.","message":"Users on M1 Macs attempting to build `clvm-tools-rs` from source might encounter build issues. The underlying Rust project sometimes requires specific build flags for M1 architecture.","severity":"gotcha","affected_versions":"Potentially all versions when building from source on M1 Macs."}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}