Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate/add stubs for PEP561 and add py.typed #8

Open
segevfiner opened this issue Nov 2, 2021 · 5 comments
Open

Generate/add stubs for PEP561 and add py.typed #8

segevfiner opened this issue Nov 2, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@segevfiner
Copy link
Owner

Need to figure out a way to extract the types from the Cython module to a *.pyi stub file and add a py.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 a from ._cypcap import *

@segevfiner
Copy link
Owner Author

This also depends on either finding a third party way to do this or for Cython to add builtin support.

@segevfiner
Copy link
Owner Author

Apparently neither mypy nor pyright can successfully generate a draft stub file from a native Cython module 🤷‍♂️

@segevfiner
Copy link
Owner Author

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...

@FeldrinH
Copy link

FeldrinH commented Dec 16, 2023

There seems to be some relevant progress in cython/cython#3818 and cython/cython#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.

@FeldrinH
Copy link

FeldrinH commented Dec 16, 2023

In the meantime it might also be worth checking out the existing .pyx -> .pyi converters mentioned here: cython/cython#3818 (comment)

@segevfiner segevfiner added the enhancement New feature or request label Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants