Add PEP 561 type stubs for chiavdf#366
Open
emlowe wants to merge 1 commit into
Open
Conversation
Move the pybind extension to a private chiavdf._chiavdf module and re-export the public API from chiavdf/__init__.py with __init__.pyi and py.typed. Run stubtest in CI after building the extension. 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 cdbc6d2. Configure here.
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
chiavdfas a proper PEP 561 module withpy.typedand__init__.pyichiavdf._chiavdfand re-export the public API fromchiavdf/__init__.py(import path unchanged for callers)stubtestto the Ubuntu check job (build extension, then validate stubs against runtime)chiavdf/(same pattern as other Chia native wheels)Test plan
Check - Ubuntu 3.12 Intelpasses (flake8, mypy, stubtest)[mypy-chiavdf.*] ignore_missing_importsMade with Cursor
Note
Low Risk
Changes are packaging, typing, and CI only; VDF logic is unchanged aside from renaming the extension module, with stubtest intended to catch API mismatches.
Overview
This PR makes chiavdf a PEP 561–typed package while keeping the public import path the same (
from chiavdf import …).The pybind11 extension is built as
chiavdf._chiavdfinstead of a top-level extension module;chiavdf/__init__.pyre-exports the VDF API, and__init__.pyipluspy.typeddocument types for mypy and other checkers.setup.py/ CMake /fastvdf.cppare updated so the native target is_chiavdf.CI on Ubuntu gains cmake/GMP install deps, extends flake8 and mypy to the
chiavdfpackage, and runsstubtestafterpip install .. cibuildwheel temporarily renames the sourcechiavdf/tree during wheel tests so pytest uses the built wheel, not the checkout.Reviewed by Cursor Bugbot for commit cdbc6d2. Bugbot is set up for automated code reviews on this repo. Configure here.