Metadata-Version: 2.3
Name: protoxy
Version: 0.7.0rc2
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Dist: protobuf ~=5.27.2
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# protoxy

A compiler for .proto files into FileDescriptorSets.
Actually python bindings for the [protox](https://github.com/andrewhickman/protox) rust library.


# Installation

```bash
pip install protoxy
```

# Usage

```python
import protoxy

# Compile a proto file (returns a FileDescriptorSets object using the protobuf library)
fds = protoxy.compile(["path/to/file.proto"])

# Compile a proto file (returns a binary FileDescriptorSets object)
fds_bin = protoxy.compile_bin(["path/to/file.proto"])

# Compile a proto file into a dynamic python module
mod = protoxy.compile_module(["path/to/file.proto"])

# The returned module is similar to the one generated by protoc
mod.file_pb2.Message()
```

# Additional options

All those apis have additional options that can be passed as keyword arguments.


- files: List of files to compile (can be strings or `os.PathLike` objects)

- includes: List of include paths (can be strings or `os.PathLike` objects)

- include_imports: Sets whether the output `FileDescriptorSet` should include imported files.
  only files explicitly included in `files` are included. If this option is set, imported files are included too.

- include_source_info: Include source info in the output (this includes comments found in the source files)

- use_protoc: Use the `protoc` binary to compile the files. If this is set to `False`, the Rust implementation

