Yet another tool that compiles .proto strings and import the outcome Python modules.
Project description
Yet another tool that compiles .proto strings and import the outcome Python modules.
Installation
pip install proto-topy
Usage example
import sys, os
from pathlib import Path
from distutils.spawn import find_executable
from proto_topy.entities import ProtoModule
from google.protobuf.timestamp_pb2 import Timestamp
protoc_path = Path(find_executable("protoc") or os.environ.get('PROTOC'))
source = """
syntax = "proto3";
import "google/protobuf/timestamp.proto";
message Test5 {
google.protobuf.Timestamp created = 1;
}
"""
proto = ProtoModule(file_path=Path("test5.proto"), source=source).compiled(protoc_path)
sys.modules["test5"] = proto.py
assert isinstance(proto.py.Test5().created, Timestamp)
More examples in test_proto_topy.py.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
proto-topy-0.0.18.tar.gz
(23.7 kB
view hashes)
Built Distribution
Close
Hashes for proto_topy-0.0.18-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 470b3ac321bfb0ae1446c83b1398fd178554ceeb63f8ea3628f4222ee1199658 |
|
MD5 | a92cd0ad1715453d01b659da0ff4287a |
|
BLAKE2b-256 | b18397e12de1ae8e51d3760033f528dd83732bee1827af37e54e162b970a7aa2 |