{"id":16217235,"url":"https://github.com/synodriver/sproto","last_synced_at":"2025-03-19T10:30:43.359Z","repository":{"id":57673519,"uuid":"480032222","full_name":"synodriver/sproto","owner":"synodriver","description":"pythonic sproto binding","archived":false,"fork":false,"pushed_at":"2024-03-28T11:42:50.000Z","size":1202,"stargazers_count":6,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-11T11:26:01.582Z","etag":null,"topics":["cython","python","python3","sproto"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/synodriver.png","metadata":{"files":{"readme":"README.markdown","changelog":"changename.py","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":"2022-04-10T13:52:43.000Z","updated_at":"2024-04-10T05:28:42.000Z","dependencies_parsed_at":"2024-03-28T12:49:19.516Z","dependency_job_id":"786388f8-6dbb-4cce-814e-13210bc916e2","html_url":"https://github.com/synodriver/sproto","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synodriver%2Fsproto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synodriver%2Fsproto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synodriver%2Fsproto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/synodriver%2Fsproto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/synodriver","download_url":"https://codeload.github.com/synodriver/sproto/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243982182,"owners_count":20378605,"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":["cython","python","python3","sproto"],"created_at":"2024-10-10T11:26:12.818Z","updated_at":"2025-03-19T10:30:42.950Z","avatar_url":"https://github.com/synodriver.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\u003ci\u003e✨ Pysproto ✨ \u003c/i\u003e\u003c/h1\u003e\n\n\u003ch3 align=\"center\"\u003eAnother Pythonic Sproto Python binding for \u003ca href=\"https://github.com/cloudwu/sproto\"\u003esproto\u003c/a\u003e \u003c/h3\u003e\n\n\u003ch3 align=\"center\"\u003e\u003ci\u003ePowered by cython, high performance, pythonic\u003c/i\u003e\u003c/h3\u003e\n\n[![pypi](https://img.shields.io/pypi/v/sproto.svg)](https://pypi.org/project/sproto/)\n![python](https://img.shields.io/pypi/pyversions/sproto)\n![implementation](https://img.shields.io/pypi/implementation/sproto)\n![wheel](https://img.shields.io/pypi/wheel/sproto)\n![license](https://img.shields.io/github/license/synodriver/sproto.svg)\n![action](https://img.shields.io/github/workflow/status/synodriver/sproto/build%20wheel)\n\n\n### Usage\n\n- install\n```\npip install sproto\n```\n\n- encode \u0026 decode\n```python\nfrom pysproto import parse, parse_ast, Sproto\nast = parse(\"\"\".package {\n                    type 0 : integer\n                    session 1 : integer\n                    }\"\"\")\ndump = parse_ast(ast)\nproto = Sproto(dump)\ntp = proto.querytype(\"package\")\nencoded = tp.encode({\"type\": 1, \"session\": 2})\nprint(tp.decode(encoded))\n```\n\n- Public functions\n```python\nfrom typing import Union, Tuple, Optional\n\nclass Sproto:\n    def dump(self)-\u003eNone: ...\n    def protocol(self, tag_or_name: Union[int, str]) -\u003e Tuple[Union[int, str], Optional[\"SprotoType\"], Optional[\"SprotoType\"]]: ...\n    def querytype(self, type_name) -\u003e \"SprotoType\": ...\n    def sproto_protoresponse(self, intproto) -\u003e int: ...\n\nclass SprotoError(Exception): ...\n\nclass SprotoType:\n    @classmethod\n    def __init__(self, *args, **kwargs) -\u003e None: ...\n    def decode(self, buffer: bytes) -\u003e dict: ...\n    def encode(self, data: dict) -\u003e bytes: ...\n    def encode_into(self, data: dict, buffer: bytearray) -\u003e int: ...\n\ndef pack(data: bytes) -\u003e bytes: ...\ndef pack_into(data: bytes, buffer: bytearray) -\u003e int: ...\ndef unpack(data: bytes) -\u003e bytes: ...\ndef unpack_into(data: bytes, buffer: bytearray) -\u003e int: ...\n```\n- ```xx_into``` functions accepts buffer protocol objects, which is zerocopy.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynodriver%2Fsproto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsynodriver%2Fsproto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynodriver%2Fsproto/lists"}