{"id":49465712,"url":"https://github.com/qdeli187/protodantic","last_synced_at":"2026-04-30T12:32:21.820Z","repository":{"id":324131522,"uuid":"1094550156","full_name":"qdeli187/protodantic","owner":"qdeli187","description":"A pydantic extension to serialize data using protobuf","archived":false,"fork":false,"pushed_at":"2026-02-09T11:50:06.000Z","size":2084,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-30T12:32:13.057Z","etag":null,"topics":["fastapi","faststream","grpc","protobuf","pydantic","python","sqlmodel"],"latest_commit_sha":null,"homepage":"https://qdeli187.github.io/protodantic/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qdeli187.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"docs/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"docs/roadmap.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-11T21:27:20.000Z","updated_at":"2025-11-15T19:17:04.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/qdeli187/protodantic","commit_stats":null,"previous_names":["qdeli187/protodantic"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/qdeli187/protodantic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qdeli187%2Fprotodantic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qdeli187%2Fprotodantic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qdeli187%2Fprotodantic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qdeli187%2Fprotodantic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qdeli187","download_url":"https://codeload.github.com/qdeli187/protodantic/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qdeli187%2Fprotodantic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32465009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["fastapi","faststream","grpc","protobuf","pydantic","python","sqlmodel"],"created_at":"2026-04-30T12:32:21.079Z","updated_at":"2026-04-30T12:32:21.798Z","avatar_url":"https://github.com/qdeli187.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Protodantic\n\nA powerful Pydantic extension that brings **Protocol Buffers** serialization to your Python models. Combine the validation power of Pydantic with the efficiency of protobuf encoding.\n\nCheck out the docs [here](https://qdeli187.github.io/protodantic/)\n\n---\n\n## ✨ Features\n\n- 🔄 **Seamless Integration**: Extend your Pydantic models with protobuf serialization\n- ⚡ **Efficient Encoding**: Convert Python objects to compact protobuf bytes\n- 🔀 **Bidirectional**: Serialize to bytes and deserialize back to Python objects\n- 📦 **Type Support**: Handle primitives, strings, nested messages, and repeated fields\n- ✅ **Validated**: Automatic validation with Pydantic\n- 🎯 **Simple API**: Just inherit from `ProtoModel` instead of `BaseModel`\n\n## 🛠️ Installation\n\n\u003e Package is not released yet\n\n```bash\npip install protodantic\n```\n\n## 📚 Quick Start\n\n### Define Your Models\n\n```python\nfrom protodantic import ProtoModel\n\nclass Address(ProtoModel):\n    street: str\n    city: str\n    zipcode: str\n\nclass Person(ProtoModel):\n    name: str\n    age: int\n    email: str\n    phone: str | None = None\n    address: Address\n    hobbies: list[str] = []\n    is_active: bool\n    salary: float | None = None\n```\n\n### Serialize to Protobuf\n\n```python\n# Create an instance\nperson = Person(\n    name=\"John Doe\",\n    age=30,\n    email=\"john@example.com\",\n    address=Address(\n        street=\"123 Main St\",\n        city=\"Anytown\",\n        zipcode=\"12345\"\n    ),\n    hobbies=[\"reading\", \"gaming\"],\n    is_active=True,\n    salary=55000.50\n)\n\n# Convert to protobuf bytes\nproto_bytes = person.model_dump_proto()\nprint(proto_bytes)  # b'\\n\\x08John Doe\\x10\\x1e...'\n```\n\n### Deserialize from Protobuf\n\n```python\n# Parse protobuf bytes back to Python object\nrestored_person = Person.model_validate_proto(proto_bytes)\nassert restored_person == person  # ✅ Perfect match!\n```\n\n## 🎨 Supported Types\n\n| Type | Wire Type | Example |\n|------|-----------|---------|\n| `int` | Varint | `age: 30` |\n| `bool` | Varint | `is_active: True` |\n| `enum` | Varint |  |\n| `float` | 64-bit | `salary: 55000.50` |\n| `str` | Length-delimited | `name: \"John\"` |\n| `bytes` | Length-delimited | `id: b'\\x01\\x02\\x03'` |\n| `ProtoModel` | Message | Nested objects |\n| `list[T]` | Repeated | `hobbies: [\"reading\", \"gaming\"]` |\n| `T \\| None` | Optional | `phone: None` |\n\n## 📄 License\n\nThis project is licensed under the Apache 2.0 License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqdeli187%2Fprotodantic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqdeli187%2Fprotodantic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqdeli187%2Fprotodantic/lists"}