$ protoc --version; python --version; pip show betterproto; pip show grpcio-tools
bash: protoc: command not found
Python 3.11.9
Name: betterproto
Version: 2.0.0b6
Location: /home/luca/devel/frequenz-microgrid-betterproto/.direnv/python-3.11.9/lib/python3.11/site-packages
Requires: grpclib, python-dateutil
Required-by: frequenz-microgrid-betterproto
Name: grpcio-tools
Version: 1.63.0
Location: /home/luca/devel/setuptools-betterproto/.direnv/python-3.11/lib/python3.11/site-packages
Requires: grpcio, protobuf, setuptools
(I'm using grpcio-tools to generate the files, not protoc)
Checklist
[X] I have searched the issues for duplicates.
[X] I have shown the entire traceback, if possible.
[X] I have verified this issue occurs on the latest prelease of betterproto which can be installed using pip install -U --pre betterproto, if possible.
Summary
mypy --strict
fails withName "betterproto.ServiceStub" is not defined
Reproduction Steps
mypy
on the generated codeExpected Results
mypy
passes.Actual Results
Where the stub class is defined in the generated code.
I see the symbol is imported in https://github.com/danielgtaylor/python-betterproto/blob/master/src/betterproto/__init__.py, but it seems like
mypy
needs imported symbols to be explicitly exported, probably via__all__
or usingfrom x import y as y
(see https://peps.python.org/pep-0484/#stub-files).System Information
(I'm using
grpcio-tools
to generate the files, notprotoc
)Checklist
pip install -U --pre betterproto
, if possible.