Open segevfiner opened 2 years ago
This also depends on either finding a third party way to do this or for Cython to add builtin support.
Apparently neither mypy nor pyright can successfully generate a draft stub file from a native Cython module 🤷♂️
It seems there is some bizarre conflict here where pylance/pyright expects typing files to include docstrings and default values, but none of the existing ones do...
There seems to be some relevant progress in https://github.com/cython/cython/pull/3818 and https://github.com/cython/cython/pull/5744. I would love to see this issue resolved, because as it is right now, my IDE fails to find any type info for cypcap and considers every reference to a cypcap method or class an error.
In the meantime it might also be worth checking out the existing .pyx -> .pyi converters mentioned here: https://github.com/cython/cython/pull/3818#issuecomment-1666687625
Need to figure out a way to extract the types from the Cython module to a
*.pyi
stub file and add apy.typed
file. This should enable autocompletion and type checking.This will require converting from a single file module to a package though. Not sure whether to place all code in an
__init__.pyx
or include an internal_cypcap.pyx
and have__init__.py
do afrom ._cypcap import *