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.1.25.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c3c13b40cca47f29136be75ae8bc467d3127950d510157c72bcaee2647bd641 |
|
MD5 | 6e80ea394bc63460acffc37c071acb77 |
|
BLAKE2b-256 | ac25183f91fee1cf50c47fe5451678f00b99014bb9886f8706fff070bef4ca5e |
Close
Hashes for protobuf2pydantic-2023.1.25-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ce4bfa7db9edfaed93a5565772748915e63c27dfc0185609a650b33d5c4f3e2 |
|
MD5 | 822c4a463a8786cddebd6c4c4d62a137 |
|
BLAKE2b-256 | 9b96dfb9fd04c2caece6c7af59c8ed7f4b6ac6d545350dd77ab690b0c6ef112e |