How to get parameter hints in VSCode for pyd files in general and confluent_kafka specifically?

Question:

I am new to kafka, and trying work some basic examples via VScode. The problem is I can’t seem to make parameter hints work at all for all the artefacts imported via confluent_kafka. The module itself is a wrapper, and I was wondering if there was a way to get parameter hinting the same way other python classes and modules work?

enter image description here

Asked By: Imad

||

Answers:

It’s impossible. Because what you want was stored in the file of cimpl.cp39-win_amd64.pyd.

The Language Server can not provide Intellisense from the file with pyd filename extension.

You can have a look at the cimply with PyCharm, as it can decompilation it.

Answered By: Steven-MSFT

Currently, it is not supported by VScode. One way to get the tooltips is to create a .pyi file for your package which defines the interface the functions. If you ship this with the package (or have this file in your VSCode working directory) it will be able to give parameter hints and such!

You can create one using mypy‘s stubgen, but it does not automatically include the docstrings. You can write one yourself however. Have a look here: Python: Generate function stubs from C module

Answered By: Thomas Wagenaar