[tahoe-lafs-trac-stream] [Tahoe-LAFS] #3399: Evaluate adding mypy checks to code checks

Tahoe-LAFS trac at tahoe-lafs.org
Sun Nov 29 17:29:45 UTC 2020


#3399: Evaluate adding mypy checks to code checks
-----------------------------+------------------------------
     Reporter:  jaraco       |      Owner:
         Type:  enhancement  |     Status:  new
     Priority:  normal       |  Milestone:  Support Python 3
    Component:  unknown      |    Version:  n/a
   Resolution:               |   Keywords:
Launchpad Bug:               |
-----------------------------+------------------------------

Comment (by jaraco):

 Today, I attempted to replicate the issue in isolation, but failed:

 {{{
 test $ ls
 mypy.ini  remote.py
 test $ cat mypy.ini
 [mypy]
 ignore_missing_imports = True
 plugins=mypy_zope:plugin
 test $ cat remote.py
 __requires__ = [
     'mypy-zope at git+https://github.com/jaraco/mypy-zope at bugfix/21
 -InterfaceClass-subclass',
     'foolscap at git+https://github.com/jaraco/foolscap at bugfix/75-use-
 metaclass',
 ]


 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
 test $ pip-run --use-pep517 -- -m mypy remote.py
 Collecting mypy-zope@ git+https://github.com/jaraco/mypy-zope@bugfix/21
 -InterfaceClass-subclass
   Cloning https://github.com/jaraco/mypy-zope (to revision bugfix/21
 -InterfaceClass-subclass) to
 /private/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-install-
 0kbosrxs/mypy-zope_a3857a33b4424ad28fc9a092a32deb1f
   Installing build dependencies ... done
   Getting requirements to build wheel ... done
     Preparing wheel metadata ... done
 Collecting foolscap@ git+https://github.com/jaraco/foolscap@bugfix/75-use-
 metaclass
   Cloning https://github.com/jaraco/foolscap (to revision bugfix/75-use-
 metaclass) to /private/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T
 /pip-install-0kbosrxs/foolscap_7a99538f390f4567a7f8091539bf4071
   Installing build dependencies ... done
   Getting requirements to build wheel ... done
     Preparing wheel metadata ... done
 Collecting mypy==0.790
   Using cached mypy-0.790-py3-none-any.whl (2.4 MB)
 Collecting zope.interface
   Using cached zope.interface-5.2.0-cp39-cp39-macosx_10_9_x86_64.whl (194
 kB)
 Collecting zope.schema
   Using cached zope.schema-6.0.0-py2.py3-none-any.whl (85 kB)
 Collecting six
   Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
 Processing
 /Users/jaraco/Library/Caches/pip/wheels/e5/5c/53/f56b69010340b883474a456e8ee34b546e27f78f01b36701e3/Twisted-20.3.0-cp39-cp39-macosx_10_9_x86_64.whl
 Collecting pyOpenSSL
   Using cached pyOpenSSL-20.0.0-py2.py3-none-any.whl (54 kB)
 Collecting typed-ast<1.5.0,>=1.4.0
   Using cached typed_ast-1.4.1-cp39-cp39-macosx_10_15_x86_64.whl (225 kB)
 Collecting mypy-extensions<0.5.0,>=0.4.3
   Using cached mypy_extensions-0.4.3-py2.py3-none-any.whl (4.5 kB)
 Collecting typing-extensions>=3.7.4
   Using cached typing_extensions-3.7.4.3-py3-none-any.whl (22 kB)
 Collecting setuptools
   Using cached setuptools-50.3.2-py3-none-any.whl (785 kB)
 Collecting zope.event
   Using cached zope.event-4.5.0-py2.py3-none-any.whl (6.8 kB)
 Collecting constantly>=15.1
   Using cached constantly-15.1.0-py2.py3-none-any.whl (7.9 kB)
 Collecting attrs>=19.2.0
   Using cached attrs-20.3.0-py2.py3-none-any.whl (49 kB)
 Collecting incremental>=16.10.1
   Using cached incremental-17.5.0-py2.py3-none-any.whl (16 kB)
 Collecting hyperlink>=17.1.1
   Using cached hyperlink-20.0.1-py2.py3-none-any.whl (48 kB)
 Collecting Automat>=0.3.0
   Using cached Automat-20.2.0-py2.py3-none-any.whl (31 kB)
 Collecting PyHamcrest!=1.10.0,>=1.9.0
   Using cached PyHamcrest-2.0.2-py3-none-any.whl (52 kB)
 Collecting service-identity>=18.1.0
   Using cached service_identity-18.1.0-py2.py3-none-any.whl (11 kB)
 Collecting idna!=2.3,>=0.6
   Using cached idna-2.10-py2.py3-none-any.whl (58 kB)
 Collecting cryptography>=3.2
   Using cached cryptography-3.2.1-cp35-abi3-macosx_10_10_x86_64.whl (1.8
 MB)
 Collecting pyasn1
   Using cached pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
 Collecting pyasn1-modules
   Using cached pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
 Collecting cffi!=1.11.3,>=1.8
   Using cached cffi-1.14.4-cp39-cp39-macosx_10_9_x86_64.whl (177 kB)
 Collecting pycparser
   Using cached pycparser-2.20-py2.py3-none-any.whl (112 kB)
 Building wheels for collected packages: mypy-zope, foolscap
   Building wheel for mypy-zope (PEP 517) ... done
   Created wheel for mypy-zope: filename=mypy_zope-0.2.9.dev0-py3-none-
 any.whl size=29442
 sha256=5d416c94987932d4c62552cce217a14f007896c9fc8cec702b6474f390aa960b
   Stored in directory:
 /private/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-ephem-wheel-
 cache-
 5rfaa5xe/wheels/6e/93/57/0be05da77af6d6324f8375d9f7a1f91d5b6cc20b91e6c28c80
   Building wheel for foolscap (PEP 517) ... done
   Created wheel for foolscap: filename=foolscap-20.4.0+5.gd70d8ec-py2.py3
 -none-any.whl size=312412
 sha256=ef46bd7f18023168363e657dfbda7085f2464756064532135a3dd1f1115cbde5
   Stored in directory:
 /private/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-ephem-wheel-
 cache-
 5rfaa5xe/wheels/c5/da/84/b38eac115cb1fc7f17f674229e212cabfa64975c03dc178ba5
 Successfully built mypy-zope foolscap
 Installing collected packages: pycparser, six, setuptools, pyasn1, idna,
 cffi, attrs, zope.interface, PyHamcrest, pyasn1-modules, incremental,
 hyperlink, cryptography, constantly, Automat, zope.event, typing-
 extensions, typed-ast, twisted, service-identity, pyOpenSSL, mypy-
 extensions, zope.schema, mypy, mypy-zope, foolscap
 Successfully installed Automat-20.2.0 PyHamcrest-2.0.2 attrs-20.3.0
 cffi-1.14.4 constantly-15.1.0 cryptography-3.2.1
 foolscap-20.4.0+5.gd70d8ec hyperlink-20.0.1 idna-2.10 incremental-17.5.0
 mypy-0.790 mypy-extensions-0.4.3 mypy-zope-0.2.9.dev0 pyOpenSSL-20.0.0
 pyasn1-0.4.8 pyasn1-modules-0.2.8 pycparser-2.20 service-identity-18.1.0
 setuptools-50.3.2 six-1.15.0 twisted-20.3.0 typed-ast-1.4.1 typing-
 extensions-3.7.4.3 zope.event-4.5.0 zope.interface-5.2.0 zope.schema-6.0.0
 Success: no issues found in 1 source file
 }}}

 No issues found even with the pre-release versions of those branches.

 But, using the same reproducer but running with mypy as found in the tahoe
 project, the error does emerge:

 {{{
 test $ ~/p/tahoe-lafs/.tox/typechecks/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)
 }}}

--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3399#comment:20>
Tahoe-LAFS <https://Tahoe-LAFS.org>
secure decentralized storage


More information about the tahoe-lafs-trac-stream mailing list