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?
Asked
Active
Viewed 1,512 times
3

Imad
- 2,358
- 5
- 26
- 55
-
Unclear what you mean "wrapper". The source code still has defined annotations and parameters that should show in the IDE – OneCricketeer Aug 23 '21 at 05:26
-
@OneCricketeer, the `Producer` is made with C, but interpreted (converted?) with `.cimpl`, as shown in the repo here : https://github.com/confluentinc/confluent-kafka-python/blob/master/src/confluent_kafka/__init__.py – Imad Aug 23 '21 at 07:50
-
Maybe I've only used Pycharm, where I think it does work – OneCricketeer Aug 23 '21 at 12:05
-
See feature request [here](https://github.com/microsoft/pylance-release/issues/166) – Imad Aug 24 '21 at 08:12
2 Answers
2
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.

Steven-MSFT
- 7,438
- 1
- 5
- 13
-
According to @OneCricketeer pycharm can do it. Any idea what aspect of pycharm is different in this regard? How can decompilation point towards the function parameters in python? – Imad Aug 23 '21 at 12:50
-
2@Imad Yes the PyCharm can do it, but the Language Server of python in the VSCode has not this ability. I had submitted a feature request on GitHub, you can refer to [here](https://github.com/microsoft/pylance-release/issues/1711) – Steven-MSFT Aug 24 '21 at 02:11
-
@Imad Does this help? If you have any doubt about it, feel free to let me know. – Steven-MSFT Aug 24 '21 at 05:34
-
thanks for your efforts, although the feature request was shut down really fast... I wonder what elements should be taken into account to create a VS Extension – Imad Aug 24 '21 at 07:48
-
@Imad This feature seems to need to be combined with the related Language Server and the Python Extension. – Steven-MSFT Aug 24 '21 at 07:54
-
It's a bummer. I hope they will implement this ability in the future anyway. – a_girl Jan 21 '22 at 13:57
1
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

Thomas Wagenaar
- 6,489
- 5
- 30
- 73