Registry / testing / pylint-protobuf

pylint-protobuf

JSON →
library0.22.0pypypi✓ verified 82d ago

A Pylint plugin that makes Pylint aware of the fields of protobuf-generated classes, preventing false positives like 'no-member' when accessing protobuf message attributes. Current version: 0.22.0. Released periodically, with the last release in 2021.

pip install pylint-protobuf
INSTALL
IMPORT
SIG · PYLINT-PROTOBUF
P
pylint-protobuf
testingpythonv0.22.0
Install
3.0s avg
Import
Disk
28MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.22.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 29MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.0s · import 0.000s · 30MB
28MB installed
● package 28MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ProtobufDescriptorChecker
from pylint_protobuf import ProtobufDescriptorChecker
from pylint_protobuf import register_protobuf_visitors

Load the plugin via Pylint's --load-plugins flag or config file to eliminate false positives on protobuf fields.

# Write a .pylintrc or pyproject.toml with: # [MASTER] # load-plugins=pylint_protobuf # # Then run pylint on your project. # Example of usage without config file: import os os.system('pylint --load-plugins=pylint_protobuf my_module.py')
Debug
Known issues
gotchaThe plugin only works if the protobuf descriptor files are generated *with* the --descriptor_set_out flag and accessible at runtime. Without descriptors, fields are not recognized.
fix
Ensure that your protobuf compilation includes --descriptor_set_out and that the generated descriptor files are deployed alongside the code.
affects: all
deprecatedThe import path has changed from 'pylint-protobuf' (hyphen) to 'pylint_protobuf' (underscore). Loading the old name will fail with a module-not-found error.
fix
Use 'pylint_protobuf' in your Pylint config or command line.
affects: >=0.20.0
breakingVersion 0.21.0 dropped support for Python 2 and older Pylint versions (<2.4).
fix
Upgrade to Python 3.6+ and Pylint 2.4+.
affects: >=0.21.0
Upgrade
Version history
0.22.0latest on PyPI · released Dec 10, 2023
Audit
Dependencies
pylintrequiredRequired runtime dependency; the plugin extends Pylint.
protobufrequiredRequired to analyse protobuf-generated classes.
Agent activity
12 hits · last 30 days
node
10
Amazon
1
Resources
pylint-protobuf — pip install pylint-protobuf · libregistry