Skip to main content

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";

Release files for protobuf2pydantic 2023.12.21

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for protobuf2pydantic 2023.12.21
File Size Uploaded
protobuf2pydantic-2023.12.21.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for protobuf2pydantic 2023.12.21
File Interpreter ABI Platform
protobuf2pydantic-2023.12.21-py3-none-any.whl Python 3 none any Details

Total release size: 20.1 kB

Release files / protobuf2pydantic-2023.12.21.tar.gz

Download URL protobuf2pydantic-2023.12.21.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a631bd5d445daf82e66547be5b6cf356904cb91817b69ee02f7b3fcd1d900c6d
BLAKE2b-256 checksum
How to use checksums
27904ea68ff6fd344d76405ffcfc80645d68f9bf84255c1bef66790626dda916
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Release files / protobuf2pydantic-2023.12.21-py3-none-any.whl

Download URL protobuf2pydantic-2023.12.21-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c90651edaced537f7d1be2a7a6a9dff45c56c990994c56e3c393815de395bab8
BLAKE2b-256 checksum
How to use checksums
99e3b3f68238d620095718cc19f7ba74bf82979c2cd7f86c86774eb2040ae0b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Release history Release notifications | RSS feed

This release

2023.12.21 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page