microsoft / python-type-stubs

A set of type stubs for popular Python packages. These are works in progress from the Microsoft Python team and others, with the intent that they are contributed to typeshed or to the associated packages once sufficiently complete.
MIT License
251 stars 99 forks source link

Intellisense does work with GTK+ 3 (GObject Introspection) #204

Open jrsrjrsr opened 4 years ago

jrsrjrsr commented 4 years ago

Environment data

Expected behaviour

Autocomplete should show member functions and variables for GTK+ 3 library (import gi)

Actual behaviour

Autocomplete does not work for import gi

Logs

Nothing of relevance appeared to be in the logs for the language server. Things like: "setFileOpened, getDiagnosticsForRange, parsing file, binding, file, getSemanticTokens", but nothing odd.

Code Snippet / Additional information

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
win = Gtk.

Key issue: This works as expected if I change the language server to jedi, but does not work with pylance. Autocomplete also works fine in the Ubuntu command line interpreter (python3).

Related discussion that I found (but had trouble interpreting) on other github projects:

judej commented 4 years ago

@jrsrjrsr, thanks for the report. GTK is a compiled module so we need to create stubs for it. Until then, there will not be completions. I will add this the list of compiled modules that need stubs. Thanks

sickpancake commented 2 years ago

Hello - any update on this issue?

I am using VSCode + Pylance for Python/GTK coding. Unable to autocomplete is a bit inconvenience. Would appreicate if there is a progress. Thanks!

erictraut commented 2 years ago

This library doesn't contain any type information currently, and it's largely written in compiled code, so type information cannot be inferred from Python sources. Someone who is familiar with the library will need to create type stubs for the library. Ideally, the library authors would include these stubs with the library so consumers of the library don't need to locate and install the stubs separately. This is the approach most library authors are taking. If this is a library that you depend upon, please consider filing a feature request with the library authors. If you're really ambitious, consider contributing type stubs to the pygtk project.

szblajos commented 2 years ago

How about pygobject-stubs project on github? It is located here. Although it is currently in a very early state (0.0.8), but seems to be a promising one

fcole90 commented 2 years ago

As a temporary solution, you can use fakegir to produce stubs: https://github.com/strycore/fakegir

Avasam commented 1 year ago

How about pygobject-stubs project on github? It is located here. Although it is currently in a very early state (0.0.8), but seems to be a promising one

And as of today it's still being actively maintained. I'd recommend using existing stubs and/or contributing to them. @jrsrjrsr