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 details)
Built Distribution
File details
Details for the file proto-topy-0.0.18.tar.gz
.
File metadata
- Download URL: proto-topy-0.0.18.tar.gz
- Upload date:
- Size: 23.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d062796f7c3abfa280c776bd4af1a893754d6409fa59264ce75b6ff33b97a78 |
|
MD5 | fa21962f146ce9cc3d873a476fdd5c4e |
|
BLAKE2b-256 | 19d4495dab8f5056175ef9a0e8d10426c54010f9bd979d48c875df324d61377e |
File details
Details for the file proto_topy-0.0.18-py3-none-any.whl
.
File metadata
- Download URL: proto_topy-0.0.18-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 470b3ac321bfb0ae1446c83b1398fd178554ceeb63f8ea3628f4222ee1199658 |
|
MD5 | a92cd0ad1715453d01b659da0ff4287a |
|
BLAKE2b-256 | b18397e12de1ae8e51d3760033f528dd83732bee1827af37e54e162b970a7aa2 |