Skip to main content

A plugin for making Pylint aware of the fields of protobuf-generated classes

Project description


pylint-protobuf is a Pylint plugin for making Pylint aware of generated fields from Protobuf types.


Install from PyPI via:

pip install pylint-protobuf

Add or update pylintrc to load pylint-protobuf:



$ cat <<EOF >person.proto
message Person {
  required string name = 1;
$ protoc person.proto --python_out=.
$ cat <<EOF >
from person_pb2 import Person
p = Person('all arguments must be kwargs')
p.invalid_field = 'value' = 123
$ pip install pylint-protobuf
$ pylint --load-plugins=pylint_protobuf
************* Module readme E5904: Positional arguments are not allowed in message constructors and will raise TypeError (protobuf-no-posargs) E5901: Field 'invalid_field' does not appear in the declared fields of protobuf-generated class 'Person' and will raise AttributeError on access (protobuf-undefined-attribute) E5903: Field "" is of type 'str' and value 123 will raise TypeError at runtime (protobuf-type-error)

Supported Python Versions

pylint-protobuf supports Python 3.5 at a minimum.

Known Issues

pylint-protobuf does not currently support the following concepts:

  • Some features of extensions: non-nested extensions, HasExtension(), ClearExtension(), type checking



A protoc compiler plugin for generating .pyi stubs from .proto files. Fully-featured and well supported, a useful extension to a mypy workflow. May be better suited to your usecase if you control the entire pipeline. May not be suited if you are a downstream consumer of generated modules with no access to the original .proto definitions, in which case pylint-protobuf may be better suited for your use.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylint-protobuf-0.21.0.tar.gz (14.6 kB view hashes)

Uploaded source

Built Distribution

pylint_protobuf-0.21.0-py2.py3-none-any.whl (15.6 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page