Skip to main content

Generate a file which include pydantic models by protobuf.pb2 file

Project description

protobuf2pydantic

GitHub Build Status codecov PyPI Language grade: Python

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

protobuf2pydantic-2023.12.21.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

protobuf2pydantic-2023.12.21-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file protobuf2pydantic-2023.12.21.tar.gz.

File metadata

File hashes

Hashes for protobuf2pydantic-2023.12.21.tar.gz
Algorithm Hash digest
SHA256 a631bd5d445daf82e66547be5b6cf356904cb91817b69ee02f7b3fcd1d900c6d
MD5 2afef047d56b71e862881f00881ebafe
BLAKE2b-256 27904ea68ff6fd344d76405ffcfc80645d68f9bf84255c1bef66790626dda916

See more details on using hashes here.

File details

Details for the file protobuf2pydantic-2023.12.21-py3-none-any.whl.

File metadata

File hashes

Hashes for protobuf2pydantic-2023.12.21-py3-none-any.whl
Algorithm Hash digest
SHA256 c90651edaced537f7d1be2a7a6a9dff45c56c990994c56e3c393815de395bab8
MD5 0b5448c3de3c08594a01d70896f86f01
BLAKE2b-256 99e3b3f68238d620095718cc19f7ba74bf82979c2cd7f86c86774eb2040ae0b0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page