SAP / PyRFC

Asynchronous, non-blocking SAP NW RFC SDK bindings for Python
http://sap.github.io/PyRFC
Apache License 2.0
511 stars 140 forks source link

Create Stub File for Type Annotation #209

Open diegostammer opened 4 years ago

diegostammer commented 4 years ago

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 commented 3 years ago

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: