Add typestub generator#41377
Conversation
|
TODO:
@vincentmacri FYI |
|
Documentation preview for this PR (built with commit 16d468b; changes) is ready! 🎉 |
vincentmacri
left a comment
There was a problem hiding this comment.
This needs more documentation/comments before I can review this as I'm not familiar with the Cython libraries in use here (and presumably most other Sage contributors aren't familiar with it either).
Please add:
- A module docstring giving a high-level overview of that this code does and how it works (include links to the documentation of the relevant Cython libraries being used)
- Function docstrings (I don't think we need doctests, just descriptions of each function)
Do you intend to run this script in this PR and add the autogenerated typestubs as well? Any plans to upstream this to Cython?
| @@ -0,0 +1,625 @@ | |||
| #!/usr/bin/env python3 | |||
There was a problem hiding this comment.
Your PR description says this file was taken/adapted from somewhere else? Then it needs to include the relevant copyright info.
There was a problem hiding this comment.
I've added a link. It's really more inspiration than copy & paste of their code. For example, here we extract a list of symbols as an intermediate step while cystub directly translate the ast into a pyi.
Done now. Sorry that it took me so long.
No, I want to do this slowly and improve the typegen script along the way. This here is meant as a first working version, not as a complete solution.
Yes, in principle. Depends a bit on how open the cython devs are for this. Alternatively, one could consider making this a separate subproject. |
|
Just letting you know that I'm a bit busy this month (papers, PhD qualifying exam, etc.). I should have time to look at this in early May. |
For automatically generating/checking type stubs for Cython modules. Based on/inspired by https://github.com/Vizonex/CyStub/ (but extended to handle default values, check mode etc)
Pretty basic at the moment, main functionality is to check that the existing stubs contain exactly the methods that we expect them to have.
📝 Checklist
⌛ Dependencies