Andrey Lebedev

Results 54 comments of Andrey Lebedev

I'm not a big fan of having mypy_zope to be executed at runtime. It is a static analyzer and ideally shouldn't be a runtime dependency. And Protocols are kind of...

> How should I annotate `arg`? I think this is a question of broader scope than zope interfaces. In a pure python context, one could ask "how do I annotate...

Yes, mypy-zope doesn't know anything about `@provider`. That said, I think your declaration is not quite correct? If instance of `RequestURL` implements `IDependencyInjector`, as `registerInjector` suggests, shouldn't `RequestURL` be declared...

> Heh… I had to ask @glyph about this also. `@implementer` says that instances of the class will provide the interface. `@provider` says that the class itself does so. (Note...

> Super happy to be getting real typing via `mypy-zope`, by the way. It's great. And thanks for the quick replies to these tickets. Thanks! I'm glad mypy exists and...

@glyph, yes, that README sentence refers to this issue. This feature was supported in the earlier version, but since interface checking was reimplemented, I had to drop it. The reason...

If I remember correctly, the issue is boils down to the type difference between class and instance attributes, e.g. ```python class Descriptor: __get__(self, obj) -> int: return 0 class IWhatever(Interface):...

We can definiely make it an option. @glyph, can you try uncommenting these lines and check if that actually works for your project? https://github.com/Shoobx/mypy-zope/blob/ae7ed4bebe15a37976cf49dbbbf31d317bc7f813/src/mypy_zope/plugin.py#L561-L567

Right, interface method cannot have `self` argument - it won't work at runtime (my guess). However, we might make `@zope.interface.interface.fromMethod` trick work, if that's acceptable in your case. It feels...

That looks interesting, thank you! The drawback of current mypy-zope tests is that test cases are limited to a single source file. It seems like `testing-mypy-types` is more flexible in...