Skip to main content

protopie

LALR(1) parser for protobuf.

One interesting aspect about the implementation of the parser is that we utilize Python type annotations to define the grammar productions. And the whole project passes the strict mypy type checker.

Disclaimer: This project is heavily assisted by code agents.

Note that currently only proto3 syntax is supported.

Installation

uv add protopie

Quickstart

Parse source code directly

from protopie import parse_source

source = '''
syntax = "proto3";

message User {
  string name = 1;
  int32 age = 2;
}
'''

ast = parse_source(source)

Parse files with import resolution

from protopie import parse_files

result = parse_files(
    entrypoints=["/abs/path/to/root.proto"],
    import_paths=["/abs/path/to/include"],
)

# result.files maps absolute path -> AST File node
root_ast = result.files[result.entrypoints[0]]

License

MIT

Metadata

Release files for protopie 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for protopie 0.1.0
File Size Uploaded Provenance
protopie-0.1.0.tar.gz 60.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for protopie 0.1.0
File Interpreter ABI Platform
protopie-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 89.9 kB

Release files / protopie-0.1.0.tar.gz

Download URL protopie-0.1.0.tar.gz
Size 60.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d70b1a2adeb3768bdd2c90d4f8efbc8bc892e740a00c0ead303a19e9ce20a5d8
BLAKE2b-256 checksum
How to use checksums
201e21dad2ff1b652991ff7ee1adf48d28f3b59e315ed8275d74644d56a35da3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.5

Release files / protopie-0.1.0-py3-none-any.whl

Download URL protopie-0.1.0-py3-none-any.whl
Size 29.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ed46f656a7204a086d46afd375b1e0a3958793fce8626ff7cd8742f0ab62ac9
BLAKE2b-256 checksum
How to use checksums
967d9cab8e2a099db44a817ee39c6bffac3bdb86a50838cea91158f3e8df8c1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.5

Security for protopie 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page