Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 550
Imad Avatar asked Dec 09 '25 12:12

Imad


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

like image 64
Steven-MSFT Avatar answered Dec 11 '25 02:12

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

like image 30
Thomas Wagenaar Avatar answered Dec 11 '25 02:12

Thomas Wagenaar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!