Repository navigation
Complete Python API annotations and add ty and Ruff checks - #1472
Closed
matthiaskoenig wants to merge 1 commit into
Closed
matthiaskoenig wants to merge 1 commit into
matthiaskoenig wants to merge 1 commit into
Conversation
|
Subsumed this into #1485 |
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.
Closes #1422.
The Python interface currently gives downstream type checkers little information about its SWIG API. Add a complete public stub layer covering 43 proxy classes, 884 function signatures, package exports, and the stochastic helpers, plus inline annotations for
NamedArray. Editors and type checkers can now resolve constructor overloads, simulation results, settings, callbacks, model access, sensitivity results, and container methods.The declarations follow the Python conversions in the bindings: NumPy arrays, Python lists/tuples, nullable solver factories, simulation file-output strings, and opaque SWIG handles are distinguished. Existing solver override differences have local, diagnostic-specific exceptions checked for staleness. No simulation, wrapper, or C++ logic changes.
Ship the stubs and
py.typedthrough the CMake build/install trees, source distributions, and wheels. Add scoped ty and Ruff configuration, positive and negative downstream typing fixtures, a public API/re-export coverage check against freshly generated SWIG output, and CI for Python 3.10/NumPy 1.26 and Python 3.13/current NumPy. Development commands are intest/typing/README.md.Validation:
NamedArrayruntime tests pass in both environments; its runtime AST is unchanged after stripping typing declarations.The native engine was not rebuilt for this annotation-only change.