Metadata-Version: 2.4
Name: protopie
Version: 0.1.0
Summary: Protobuf proto3 syntax parser
Project-URL: Repository, https://github.com/maralla/protopie
Author: maralla
License: MIT License
        
        Copyright (c) 2026
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
License-File: LICENSE
Keywords: parser,proto3,protobuf
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Compilers
Requires-Python: >=3.14
Description-Content-Type: text/markdown

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
------------

```bash
uv add protopie
```

Quickstart
----------

#### Parse source code directly

```python
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

```python
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](LICENSE)
