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";
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.5.31.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cd16489b12deaec45f21be7c0bfa17d0a413a9995402f2fcaf0ed23199f9e1b |
|
MD5 | a16412f4abffebcd290de359483378cd |
|
BLAKE2b-256 | 4ff799b0f427f307ea8c63c0bb8bfc87ac5259e60e0e4f0e561a9d7974232cf8 |
Close
Hashes for protobuf2pydantic-2021.5.31-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 868d4e2c9f61606e454cbc898037e7c43b60a29c97617dcc9bb03035c9114f73 |
|
MD5 | e7fd794bd467df9a75918ccf17517264 |
|
BLAKE2b-256 | 3769d3c13395a39ffe5d0199d223b484ac40663e89e16ec931e6c22ff87e0fbc |