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
$ pip install protobuf2pydantic
Getting Started
in CLI
>>> pb2py ../test_pb2.py > wow.py
in Python
>>> from protobuf2pydantic import message2pydantic
>>> from tests.test_pb2 import TestMessage
>>>
>>> klass = message2pydantic(TestMessage)
>>> print(klass)
<class 'TestMessage'>
>>> print(type(klass))
<class 'pydantic.main.ModelMetaclass'>
* Required proto file syntax = "proto3";
* No plan to support "oneof"
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.1.20.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cd38fb412ca0d3cb6f2241d8bce748dc9a23b59828db6810244ba3e0207cac2 |
|
MD5 | 61d179d625c7ebecc05637c95f83fcb2 |
|
BLAKE2b-256 | b853b4ba41286bf0e9ede5ffe12601089b0cbb4ee1ed1593204de9534767fdef |
Close
Hashes for protobuf2pydantic-2021.1.20-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 200bd1f9b58d61f269e40b39ad2c0f8f85e0d69cc8a2051d810588418ac2a1dc |
|
MD5 | bcffa91033c6c9954f302ef7e5208d88 |
|
BLAKE2b-256 | ca512c4bbd8ea0ec5a86afa920a257cb61c6f8d6f6928e82b69d5f2eaa40e09a |