vmagamedov / grpclib

Pure-Python gRPC implementation for asyncio
http://grpclib.readthedocs.io
BSD 3-Clause "New" or "Revised" License
936 stars 92 forks source link

mypy error: `Cannot instantiate abstract class "Server"` when upgrading mypy to 0.950 #158

Closed efokschaner closed 2 years ago

efokschaner commented 2 years ago

In a project using grpclib, I noticed that upgrading mypy from 0.942 to 0.950, causes an error regarding grpclib.server.Server:

error: Cannot instantiate abstract class "Server" with abstract attributes "get_loop", "is_serving", "serve_forever" and "start_serving"  [abstract]

Locally I am working around this with

server = Server(services)  # type: ignore[abstract]

It seems grpc's own tests are run on mypy 0.931 https://github.com/vmagamedov/grpclib/blob/39cc61ad45cd3be15ec464fdefab31b9f4f23918/requirements/check.txt#L18 and might reproduce the issue too if that was bumped.

Do you think that grpclib should somehow satisfy mypy? Or is mypy being over-zealous?

Either way, it's definitely preferable to not have this error show up for people just using grpclib as recommended.

LMK if you have more questions and thanks for maintaining this useful library!

vmagamedov commented 2 years ago

Thanks, I'll take a look.

vmagamedov commented 2 years ago

Fixed in d3fae8549ae18c17f9f385519eeb3427708188c4