Generated Protobuf library code is not compatible with typeshed's protobuf type stubs
Opened this issue · 1 comments
thundergolfer commented
Not too confident this will be easily fixed on the typeshed
side -> python/typeshed#2521
thundergolfer commented
✝️ 👨🏾⚕️
I think I've got a 'bandaid' solution. Add the following to the mypy.ini
:
[mypy-google.protobuf.*]
follow_imports_for_stubs = True
follow_imports = skip
making sure that that config is placed above any more general config like what's shown below.
[mypy-google.*]
ignore_missing_imports = True
The effect is that the (incorrect) protobuf typeshed stubs aren't looked at, and thus the errors within don't break our builds. The relevant piece of the MyPy docs are:
Used in conjunction with
follow_imports=skip
, this can be used to suppress the import of a module from typeshed, replacing it withAny
.