{"id":27131887,"url":"https://github.com/jkmnt/protobuf-typeddict","last_synced_at":"2025-06-14T03:05:45.947Z","repository":{"id":282316339,"uuid":"869074615","full_name":"jkmnt/protobuf-typeddict","owner":"jkmnt","description":"Create TypedDict definitions for protobuf json","archived":false,"fork":false,"pushed_at":"2025-03-13T22:28:53.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-14T03:05:42.463Z","etag":null,"topics":["protobuf","protobuf-python","typeddict","typehints"],"latest_commit_sha":null,"homepage":"","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/jkmnt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2024-10-07T17:13:22.000Z","updated_at":"2025-03-13T22:28:57.000Z","dependencies_parsed_at":"2025-03-13T23:37:53.430Z","dependency_job_id":null,"html_url":"https://github.com/jkmnt/protobuf-typeddict","commit_stats":null,"previous_names":["jkmnt/protobuf-typeddict"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jkmnt/protobuf-typeddict","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkmnt%2Fprotobuf-typeddict","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkmnt%2Fprotobuf-typeddict/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkmnt%2Fprotobuf-typeddict/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkmnt%2Fprotobuf-typeddict/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jkmnt","download_url":"https://codeload.github.com/jkmnt/protobuf-typeddict/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkmnt%2Fprotobuf-typeddict/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259752083,"owners_count":22905972,"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":["protobuf","protobuf-python","typeddict","typehints"],"created_at":"2025-04-07T21:40:48.994Z","updated_at":"2025-06-14T03:05:45.929Z","avatar_url":"https://github.com/jkmnt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# protobuf-typeddict\n\nTiny tool for generating the TypedDicts describing the protobuf's `MessageToDict`/`ParseDict` (aka `json`) representations.\n\nSome data are better manipulated as simple (typesafe) dicts instead of the python-protobuf's rich objects. Now the protobufs are just the binary serialization library.\n\n## Example\n\nGiven this ...\n\n```protobuf\nmessage Project {\n    optional fixed64 id = 1;\n    optional float billing = 2;\n    optional bool is_active = 3;\n}\n\nmessage User {\n    optional int32 id = 1;\n    optional string name = 2;\n    repeated string email = 3;\n    map\u003cstring, Project\u003e project = 4;\n}\n```\n\ngenerates this:\n\n```python\nProject = TypedDict(\n    \"Project\",\n    {\n        \"id\": NotRequired[int],\n        \"billing\": NotRequired[float],\n        \"is_active\": NotRequired[bool],\n    }\n)\n\nUser = TypedDict(\n    \"User\",\n    {\n        \"id\": NotRequired[int],\n        \"name\": NotRequired[str],\n        \"email\": list[str],\n        \"project\": dict[str, \"Project\"],\n    }\n)\n```\n\n## Installation\n\n```shell\npip install git+https://github.com/jkmnt/protobuf-typeddict.git\n```\n\n## Usage\n\n### Cli\n\npb2td installs the script `pb2td`. Run it as\n\n```shell\npb2td src_pb2.py dst.py\n```\n\nto generate the `dst.py` types.\n\n### Programmatic\n\n```python\nimport my_module_pb2\nimport pb2td\n# the result is str\nresult = pb2tf.generate(my_module_pb2)\nprint(result)\n```\n\nNOTE: The pb2td makes TypedDicts from protoc-generated `_pb2.py`/`_pb3.py` files, not the `.proto`.\n\n## Limitations\n\n- No RPC/services. Just the plain data protobufs\n- No well-known types (`datetime` etc)\n- Enums are typed as int\n- No pb2 extensions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjkmnt%2Fprotobuf-typeddict","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjkmnt%2Fprotobuf-typeddict","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjkmnt%2Fprotobuf-typeddict/lists"}