-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Thanks for taking over this very useful project.
Regarding automatic pyi generation, the current code has some shortcomings:
cdef class MyClass:
cdef public MyType myvar
cdef readonly MyType my_other_varmyvar and my_other_var will currently not appear in the pyi.
Expected pyi content:
class MyClass:
myvar : MyType
@property
def my_other_var(self) -> MyType:
....===========
Another issue regarding pyi conversion is the handling of None.
Cython will currently have different behaviour for
def myfun(myvar: MyType):
...
def my_other_fun(MyType myvar):
...myfun will require myvar to not be None, while the second accepts None. This is described in Cython's documentation.
The issue with this is sometimes when converting the second variant, the stub generator will convert to the first variant. Thus code that accepted None will raise stub warnings when passing None.
I'm not totally sure what is the best way to solve this (because in some case in the second variant, devs may have a not None check raising an error upon passing None).