Skip to content

trueagi-io/protobuf-metta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Protocol Buffers to MeTTa Converter

Description

Convert protobuf specification to MeTTa.

Build and Install

Prerequisites

  • python (tested with Python 3.9.2)
  • grpcio-tools (tested with 1.19.0)
  • wheel (tested with 0.42.0)

Build

To build the library enter the following command

python setup.py bdist_wheel

Install

To build the library enter the following command

pip install dist/protobuf_metta-0.1.0-py3-none-any.whl

Test

Optionally, you may run the tests by entering the following command

python setup.py pytest

Usage

This library works in tandem with protoc.

First, the protobuf specification must be compiled to Python via protoc, using a command such as

python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. example.proto

Second, the resulting Python protobuf files, such as

example_pb2_grpc.py
example_pb2.py

can be imported alongside protobuf-metta to be parsed and converted to MeTTa, such as

import example_pb2
from protobuf_metta import parser

proto_parser = parser.ProtobufParser(example_pb2.DESCRIPTOR)
metta_desc = proto_parser.description_to_metta()
print(metta_desc)

Example

A complete example can be found under the examples folder.

MeTTa Representation

TODO

TODO

About

Convert protobuf specification to MeTTa

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages