A pure Python library for parsing Protobuf `.proto` files into an Abstract Syntax Tree (AST)-like structure. It provides an intuitive object model for navigating and extracting information from parsed schema definitions. As of version 2.1.0, it primarily supports `proto3` syntax and offers a robust, actively maintained solution for programmatic schema inspection.
pip install proto-schema-parserVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to parse a basic Protobuf `.proto` string and access its top-level elements like syntax, package, and message names using the `ProtoParser`.
Review the new object model by inspecting the `ProtoNode` and related classes available in the library, or by printing the `parsed_proto` object and its attributes (e.g., using `dir()` or a debugger) to understand the new structure. Top-level accessors like `.syntax`, `.package`, and `.messages` often remain, but nested structures and attribute names within nodes may have changed.
Ensure your `.proto` files explicitly specify `syntax = "proto3";` for guaranteed correct parsing. If parsing `proto2` files, carefully validate the resulting AST structure against your expectations and be prepared for potential limitations.
No dependency data recorded yet.