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

Create Stub File for Type Annotation #209

Open
diegostammer opened this issue Nov 23, 2020 · 1 comment
Open

Create Stub File for Type Annotation #209

diegostammer opened this issue Nov 23, 2020 · 1 comment

Comments

@diegostammer
Copy link

Using VSCode with pylance plugin in strict mode generate a lot of errors about missing type annotation.
The request is to create a stub file (*.pyi) to document every type of constants, methods, functions, etc.

https://www.python.org/dev/peps/pep-0484/
https://www.python.org/dev/peps/pep-0561/

@bsrdjan
Copy link
Contributor

bsrdjan commented Dec 30, 2020

Thanks for the feature request and here some initial findings.

Using stubgen, stub drafts can be generated for Python sources: https://mypy.readthedocs.io/en/stable/stubgen.html

That covers very small of the project, implemented mainly in Cython (pyx source). There is no similar tool for Cython and stubs must be implemented manually, which requires more work however.

I added stubgen draft _exceptions.pyi and minimal pyrfc.pyi and tested with Pylance in basic mode. It works as expected (warnings are gone) but more work is needed to cover the whole project. PR is welcome here.

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants