{"id":13494196,"url":"https://github.com/eigenein/protobuf","last_synced_at":"2025-04-04T09:09:46.209Z","repository":{"id":40619017,"uuid":"1890285","full_name":"eigenein/protobuf","owner":"eigenein","description":"Python implementation of Protocol Buffers with dataclass-based schemaʼs","archived":false,"fork":false,"pushed_at":"2024-04-30T21:36:04.000Z","size":697,"stargazers_count":235,"open_issues_count":8,"forks_count":19,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-05-02T01:27:18.428Z","etag":null,"topics":["dataclasses","google-protocol-buffers","library","pip-package","protobuf","protocol-buffers","pypi-package","pypi-packages","python","python-3","python-data-classes","python-library","python-package","type-annotations","type-hints"],"latest_commit_sha":null,"homepage":"https://eigenein.github.io/protobuf/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eigenein.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["eigenein"]}},"created_at":"2011-06-13T18:26:55.000Z","updated_at":"2024-05-03T20:04:08.199Z","dependencies_parsed_at":"2023-12-15T22:42:43.609Z","dependency_job_id":"97cd5615-c20c-4b6e-86f4-566ca5860d81","html_url":"https://github.com/eigenein/protobuf","commit_stats":{"total_commits":341,"total_committers":10,"mean_commits":34.1,"dds":"0.22580645161290325","last_synced_commit":"b0e425bff6ff880663a0c0b58cd0444cb0100918"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eigenein%2Fprotobuf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eigenein%2Fprotobuf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eigenein%2Fprotobuf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eigenein%2Fprotobuf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eigenein","download_url":"https://codeload.github.com/eigenein/protobuf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247149502,"owners_count":20891954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dataclasses","google-protocol-buffers","library","pip-package","protobuf","protocol-buffers","pypi-package","pypi-packages","python","python-3","python-data-classes","python-library","python-package","type-annotations","type-hints"],"created_at":"2024-07-31T19:01:22.810Z","updated_at":"2025-04-04T09:09:46.193Z","avatar_url":"https://github.com/eigenein.png","language":"Python","funding_links":["https://github.com/sponsors/eigenein"],"categories":["Python"],"sub_categories":[],"readme":"# `pure-protobuf`\n\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/eigenein/protobuf/check.yml?label=checks\u0026logo=github)](https://github.com/eigenein/protobuf/actions/workflows/check.yml)\n[![Code coverage](https://codecov.io/gh/eigenein/protobuf/branch/master/graph/badge.svg?token=bJarwbLlY7)](https://codecov.io/gh/eigenein/protobuf)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/pure-protobuf.svg)](https://pypistats.org/packages/pure-protobuf)\n[![PyPI – Version](https://img.shields.io/pypi/v/pure-protobuf.svg)](https://pypi.org/project/pure-protobuf/#history)\n[![PyPI – Python](https://img.shields.io/pypi/pyversions/pure-protobuf.svg?logo=python\u0026logoColor=yellow)](https://pypi.org/project/pure-protobuf/#files)\n[![License](https://img.shields.io/pypi/l/pure-protobuf.svg)](https://github.com/eigenein/protobuf/blob/master/LICENSE)\n\n\u003csmall\u003e\u003cstrong\u003eWow! Such annotated! Very buffers!\u003c/strong\u003e\u003c/small\u003e\n\n## Documentation\n\n\u003ca href=\"https://eigenein.github.io/protobuf/\"\u003e\n    \u003cimg alt=\"Documentation\" height=\"30em\" src=\"https://img.shields.io/github/actions/workflow/status/eigenein/protobuf/docs.yml?label=documentation\u0026logo=github\"\u003e\n\u003c/a\u003e\n\n## Quick examples\n\n### `.proto` definition\n\nIt's not needed for `pure-protobuf`, but for the sake of an example, let's consider the following definition:\n\n```protobuf\nsyntax = \"proto3\";\n\nmessage SearchRequest {\n  string query = 1;\n  int32 page_number = 2;\n  int32 result_per_page = 3;\n}\n```\n\nAnd here's the same via `pure-protobuf`:\n\n### With [dataclasses](https://docs.python.org/3/library/dataclasses.html)\n\n```python title=\"dataclass_example.py\"\nfrom dataclasses import dataclass\nfrom io import BytesIO\n\nfrom pure_protobuf.annotations import Field\nfrom pure_protobuf.message import BaseMessage\nfrom typing_extensions import Annotated\n\n\n@dataclass\nclass SearchRequest(BaseMessage):\n    query: Annotated[str, Field(1)] = \"\"\n    page_number: Annotated[int, Field(2)] = 0\n    result_per_page: Annotated[int, Field(3)] = 0\n\n\nrequest = SearchRequest(query=\"hello\", page_number=1, result_per_page=10)\nbuffer = bytes(request)\nassert buffer == b\"\\x0A\\x05hello\\x10\\x01\\x18\\x0A\"\nassert SearchRequest.read_from(BytesIO(buffer)) == request\n```\n\n### With [`pydantic`](https://docs.pydantic.dev/)\n\n```python title=\"pydantic_example.py\"\nfrom io import BytesIO\n\nfrom pure_protobuf.annotations import Field\nfrom pure_protobuf.message import BaseMessage\nfrom pydantic import BaseModel\nfrom typing_extensions import Annotated\n\n\nclass SearchRequest(BaseMessage, BaseModel):\n    query: Annotated[str, Field(1)] = \"\"\n    page_number: Annotated[int, Field(2)] = 0\n    result_per_page: Annotated[int, Field(3)] = 0\n\n\nrequest = SearchRequest(query=\"hello\", page_number=1, result_per_page=10)\nbuffer = bytes(request)\nassert buffer == b\"\\x0A\\x05hello\\x10\\x01\\x18\\x0A\"\nassert SearchRequest.read_from(BytesIO(buffer)) == request\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feigenein%2Fprotobuf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feigenein%2Fprotobuf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feigenein%2Fprotobuf/lists"}