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-2023.12.21.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a631bd5d445daf82e66547be5b6cf356904cb91817b69ee02f7b3fcd1d900c6d |
|
MD5 | 2afef047d56b71e862881f00881ebafe |
|
BLAKE2b-256 | 27904ea68ff6fd344d76405ffcfc80645d68f9bf84255c1bef66790626dda916 |
Close
Hashes for protobuf2pydantic-2023.12.21-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c90651edaced537f7d1be2a7a6a9dff45c56c990994c56e3c393815de395bab8 |
|
MD5 | 0b5448c3de3c08594a01d70896f86f01 |
|
BLAKE2b-256 | 99e3b3f68238d620095718cc19f7ba74bf82979c2cd7f86c86774eb2040ae0b0 |