Skip to content
Search

Mypy-protobuf

lastmod 2021-06-08created 2021-06-081 edits

open source tools to generate mypy stubs from protobufs.

Installation

pip install mypy-protobuf

Usage

protoc --python_out=output/location --mypy_out=output/location

or

protoc --plugin=protoc-gen-mypy=path/to/protoc_gen_mypy.bat --python_out=output/location --mypy_out=output/location

Use it as shown above.

GRPC integration

This plugin provides stubs generation for grpcio generated code.

protoc \
    --python_out=output/location \
    --mypy_out=output/location \
    --grpc_out=output/location \
    --mypy_grpc_out=output/location

See also

Favorite site

author Zer0 sitemap