Conversation
Enables editor and type checker support for Qt classes.
|
Hi @maflAT My apologies for not chiming in earlier... thanks for the PR! This issue has admittedly been a sore point for us for some time... I will test this out right now on both vscode and pycharm 👍🏻 |
|
Can confirm working on pycharm
Testing on not PyQt6 also works, thanks so much for this PR @maflAT !!! |
|
@j9ac9k my pleasure, thanks for the help with checking! |
|
Hi @maflAT just a follow up on this, do you know if there is a limitation of reading stubs from relative paths? pyqtgraph internally uses relative paths, but seems like pyright is not reading the stubs. example: Import statement: from ..Qt import QtCore, QtGui, QtWidgetsUsage of one of the modules:
|
|
@j9ac9k I'm not aware of any specific limitations. This is with Pylance v2024.5.102 and PySide6 installed (no other Qt bindings). |
|
Weird!!! In my case I'm using PyQt6, but I'll try and experiment with more bindings and combinations of dependencies. Other potential oddity is that I have PyQtGraph installed as an editable install; maybe that behaves differently vs a regular install. I'll try and tinker with it more when I'm on my computer next. EDIT: I reinstalled pyqtgraph in my virtual environment w/o using editable install and it worked. Then I uninsrtalled and reinstalled in as an editable install, and the type annotations are working. I've had this virtualenv around for a while, I'm now wondering if the issue was when I did run Thanks for testing locally yourself and following up ❤️ |




Enables editor and type checker support for Qt classes.
This change provides type information to editors and type checkers.
VSCode / Pylance will still report the import statements in the new stubs as missing imports if the given package is not installed. Nevertheless, if at least one of the packages is installed, you can import and use those classes with full auto-complete support.
It would be nice if someone could test if this also works in PyCharm or other editors / type checkers. Unfortunately I'm not able to do so.
Other Tasks