Generate a file which include pydantic models by protobuf.pb2 file
Project description
protobuf2pydantic
Generate a file which include pydantic models by using protobuf.pb2 file
Installation
pip3 install protobuf2pydantic
Getting Started
in CLI
pb2py ../test_pb2.py > wow.py
in Python
from protobuf2pydantic import msg2py
from pydantic import validator
import transaction_pb2
class AmountResponse(msg2py(transaction_pb2.AmountResponse)):
@validator("amount")
def non_negative(cls, v):
assert v >= 0
return v
* Required proto file syntax = "proto3";
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
Built Distribution
Close
Hashes for protobuf2pydantic-2021.11.25.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51c3d6986cb299925769cb98052464cf34df8c347ce7aba78d7f9f561c7510f7 |
|
MD5 | f798d2fdb6f59978cac1a6bd7fdda476 |
|
BLAKE2b-256 | 4f8e1527bbe1821b83d2e2d7087746aadb01673dbbbe092d81f801c49ce94b8f |
Close
Hashes for protobuf2pydantic-2021.11.25-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a3eaea9cc05783539e5202d6e62b79532cc0687728e37e11c31b56432684aff |
|
MD5 | 59d1009198e41d4261e858bd36ae9d30 |
|
BLAKE2b-256 | 67512c8f37de43514dbf5b5f0c68e32ca40e7fb44531252d1178666f7eb44fff |