some work on type hint stubs
Kyle Altendorf
sda at fstab.net
Fri Oct 9 23:54:16 BST 2020
On 2020-10-09 17:14, Phil Thompson wrote:
> On 09/10/2020 20:04, Kyle Altendorf wrote:
>> Hi Phil,
>>
>> There's been some work over in PyQt5-stubs [0] recently. It is now
>> passing mypy --strict (with 180 reviewed ignores) and we are working
>> through the complaints from stubtest (mostly enumeration __new__
>> signatures are left). Not that automated generic checks catch
>> everything, but they are pieces of the puzzle. Perhaps this work
>> could be useful as a reference for some changes to the official stub
>> generation. If you would be interested in any help enhancing the
>> official stubs, let us know how.
>>
>> Cheers,
>> -kyle
>>
>>
>> [0] https://github.com/stlehmann/PyQt5-stubs
>
> I wasn't aware of this. It's on my list for SIP v6 to review the
> support for stubs as it hasn't much changed much since it was first
> implemented.
Since you mention SIP v6, would you expect to make corrections for
future PyQt5 releases? Or just PyQt6? I'll admit I haven't been
closely following plans.
> I'm happy to take bug reports (and patches!) to fix any issues - the
> automatically generated stubs should be correct without any need to
> maintain separate versions.
I generally agree and my intent on working on PyQt5-stubs was to try to
explore the problems and solutions without worrying about learning the
generation at the same time. Then there would be a reference target to
update the generation towards, whether I worked on it or someone else.
That said, there's enough going on here and enough things that mypy
doesn't support at present that there's room for at least some opinions
in certain areas as opposed to simply being correct and incorrect. But
anyways... Some of the stuff seems like it will just have to have a
mypy plugin. :|
https://github.com/stlehmann/PyQt5-stubs/pulls?q=is%3Apr+is%3Aclosed
The merged pull requests could constitute a list of 'bug reports'. I
tried to keep some semblance of self control and keep them granular.
Mostly. I'll also try to take a stab at learning about the existing
generation mechanisms. As changes are made upstream we can do catch up
adjustments in PyQt5-stubs to keep track of the remaining diff.
Side note, I've also got a PR in to qtpy to 'support' type hints (they
mostly just have to turn it on so the underlying hints from PyQt and
PySide can pass through, then a little helper for configuring mypy). Of
course, PySide also has various hinting issues, many similar ones, some
that I have reported.
https://github.com/spyder-ide/qtpy/issues/216
Cheers,
-kyle
More information about the PyQt
mailing list