Reconciling pyqtProperty and mypy

Florian Bruhin me at
Wed Aug 19 14:29:19 BST 2020


On Tue, Aug 18, 2020 at 02:54:14PM -0400, Ben Green wrote:
> I'm using pyqtProperty a lot, and mypy doesn't seem to play nicely with it.
> When defining the setter, it gives a "name already defined" error. Also,
> since the type is "Callable[..., Any]", instead of the actual type of the
> property, references to that property can give errors.

I dug into the mypy source code and it looks like there's quite some special
casing for properties:

Doesn't look like there's a way to customize it. Perhaps it'd be possible to
write a mypy plugin:

But I have no idea if it's possible at all.

On Wed, Aug 19, 2020 at 12:15:38PM +0300, Dmitri Bogomolov wrote:
> Shouldn't the second method have a different name?

Not for properties usually - see the examples:


me at (Mail/XMPP) | |
       GPG: 916E B0C8 FD55 A072 |
             I love long mails! |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <>

More information about the PyQt mailing list