Add PEP 561 type stubs for chialisp - #491
Merged
Merged
Conversation
Move the public API behind a private _chialisp extension module with __init__.pyi, py.typed, and stubtest CI so downstream mypy can drop ignore_missing_imports for chialisp. Co-authored-by: Cursor <cursoragent@cursor.com>
The typing job cannot use maturin develop without a venv on GitHub Actions. Build the wheel and pip install it instead. Also apply clippy's manual_option_zip suggestion in serialize.rs so the pinned toolchain job passes with -D warnings. Co-authored-by: Cursor <cursoragent@cursor.com>
Drop the nested chialisp checkout and compiled extension module from the branch, and ignore *.abi3.so going forward. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d186618. Configure here.
Keep the typing PR scoped to PEP 561 stubs and CI; the clippy lint in serialize.rs is pre-existing on main and should be fixed separately. Co-authored-by: Cursor <cursoragent@cursor.com>
prozacchiwawa
approved these changes
Jun 4, 2026
Contributor
|
Neat. |
emlowe
marked this pull request as ready for review
June 4, 2026 16:40
prozacchiwawa
approved these changes
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
_chialispRust extension re-exported from a pure-Pythonchialisppackage withpy.typedand__init__.pyi.python/clvm_tools_rs/shim with a properpython/chialisp/mixed layout (module-name = "chialisp._chialisp").typingCI job that builds the package with maturin and runsstubtest --concise chialisp.This lets chia-blockchain remove
[mypy-chialisp.*] ignore_missing_imports = Trueonce a release is published.Approach
chialisp/_chialisp.abi3.sochialisp)chialisp/__init__.pysys.modulesregistration forbinutilschialisp/__init__.pyicompile_clvm,start_clvm_program, etc.)chialisp/binutils.pyibinutilssubmodulechialisp/py.typedPublic imports are unchanged:
from chialisp import compile_clvm.Test plan
maturin build --releaseproduces wheel with_chialisp.abi3.so, stubs, andpy.typedstubtest --concise chialisppasses locallytypingjob passesMade with Cursor
Note
Low Risk
Packaging and typing surface changes only; public
from chialisp import …API is preserved via re-exports, with risk mainly around wheel layout and the removedclvm_tools_rsshim path.Overview
Adds PEP 561 typing for the
chialisppackage using a mixed Rust/Python layout: maturin now builds a private extensionchialisp._chialisp(PyO3 module renamed inapi.rs), whilepython/chialisp/holds the public__init__.pyre-exports,py.typed, and__init__.pyi/binutils.pyistubs.pyproject.tomlsetspython-sourceandmodule-nameaccordingly;.gitignoreignores local*.abi3.sobuilds.Removes the old
python/clvm_tools_rs/star-import shim and itscmds.pyhelper (compatibility for tests still goes through./tmpin CI, unchanged in this diff).Adds a
typingCI job that builds the wheel with maturin and runsstubtest --concise chialispso the published API matches the stubs.Reviewed by Cursor Bugbot for commit ee6b17b. Bugbot is set up for automated code reviews on this repo. Configure here.