Open
Description
In this comment, I isolated an issue where mypy static analysis checks are failing on a foolscap Referenceable RemoteInterface. Given this minimal implementation:
# remote.py
from foolscap.api import RemoteInterface, Referenceable
from zope.interface import implementer
class RIBucketWriter(RemoteInterface):
""" Objects of this kind live on the server side. """
def write(offset=None, data=None):
return None
@implementer(RIBucketWriter)
class BucketWriter(Referenceable):
def remote_write(self, offset, data):
pass
and this mypy configuration:
[mypy]
ignore_missing_imports = True
plugins=mypy_zope:plugin
Then, creating an environment with unmerged branches of mypy-zope and foolscap:
test $ python -m venv env
test $ env/bin/pip install -q mypy-zope@git+https://github.com/jaraco/mypy-zope@bugfix/21-InterfaceClass-subclass foolscap@git+https://github.com/jaraco/foolscap@bugfix/75-use-metaclass
Attempting to run mypy on that simple BucketWriter produces this error:
test $ env/bin/mypy remote.py
remote.py:18: error: 'BucketWriter' is missing following 'RIBucketWriter' interface members: write.
Found 1 error in 1 file (checked 1 source file)
It seems mypy is unaware of the contract that a Referenceable adds providing the required interface but with method names replaced with remote_
prefixed.
Presumably the proper fix would be to add mypy support (plugin) for these Referenceable objects.
Metadata
Metadata
Assignees
Labels
No labels