--- id: proto-schema-parser version: "2.1.0" license: MIT license_treatment: permissive maintenance: aging --- # proto-schema-parser — A Pure Python Protobuf .proto Parser License: permissive · Maintenance: aging · Downloads: 630.2K/mo ## What it is and what it does Proto Schema Parser is a pure-Python library that reads Protobuf schema files and converts them into an abstract syntax tree (AST) for programmatic inspection and manipulation. It uses ANTLR4-based lexer and parser rules autogenerated from Buf's grammar files to handle the conversion. The library also provides a Generator class to write AST objects back to valid Protobuf schema strings, making it useful for tools that need to read, analyze, or transform .proto files without invoking the official protoc compiler. The package supports proto2 and proto3 syntax, as well as the newer protobuf editions (2023 and 2024). It preserves comments, handles all major schema constructs (messages, fields, enums, services, imports, options), and works with advanced features like oneof, map types, groups, and stream RPC definitions. A developer would use this when building code generators, schema validators, documentation tools, or any system that needs to parse and understand Protobuf schemas as data structures. Use it for: - Build a code generator that reads .proto files and emits client libraries in a custom language - Validate Protobuf schemas against organizational naming or structure conventions - Extract documentation or metadata from .proto files for API documentation systems - Transform or migrate Protobuf schemas between proto2, proto3, and edition syntax - Analyze message definitions to enforce backward compatibility rules - Generate type stubs or schema diagrams from Protobuf definitions ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parses and generates Protobuf schema files (.proto) to and from an abstract syntax tree, supporting proto2, proto3, and protobuf editions 2023 and 2024. Yes, if you need to programmatically parse or generate Protobuf schemas. The package is stable, has no known vulnerabilities, and handles modern Protobuf syntax including editions. The aging maintenance status (282 days since last release) is a minor concern for long-term support, but the core functionality is mature and unlikely to require frequent updates unless Protobuf itself introduces breaking changes. ## Install pip install proto-schema-parser uv add proto-schema-parser poetry add proto-schema-parser ## Installing proto-schema-parser Before you install: Low friction installation with a single pure-Python runtime dependency (antlr4-python3-runtime). Maintenance status is aging—last release was 282 days ago—so expect slower response to issues, though no active problems are evident. License in practice: MIT license is permissive, allowing commercial and private use with minimal restrictions; you may use, modify, and distribute this package freely as long as you include the license notice. Quickstart: pip install proto-schema-parser from proto_schema_parser.parser import Parser from proto_schema_parser.generator import Generator text = 'syntax = "proto3";\nmessage Example { string field = 1; }' ast = Parser().parse(text) proto_string = Generator().generate(ast) Requires Python 3.9 or later. Verify before relying: - Performance characteristics when parsing large or deeply nested .proto files - Completeness of support for all proto2/proto3 language features beyond those listed - Whether the autogenerated lexer/parser from Buf's grammar is kept in sync with upstream changes ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 630.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags protobuf schema parser, proto file parser, protobuf ast, parse proto3 files, protobuf code generation, proto schema ast, protobuf editions support, protobuf, parser, code-generation [View on SkillFed](https://skillfed.io/packages/proto-schema-parser) · [View on PyPI](https://pypi.org/project/proto-schema-parser/)