{"id":36983642,"url":"https://github.com/0x26res/ptars","last_synced_at":"2026-02-20T10:02:47.907Z","repository":{"id":203783780,"uuid":"710212640","full_name":"0x26res/ptars","owner":"0x26res","description":"Protobuf to Arrow, using Rust","archived":false,"fork":false,"pushed_at":"2026-02-18T17:47:15.000Z","size":1598,"stargazers_count":23,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-18T20:57:58.761Z","etag":null,"topics":["python","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/0x26res.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2023-10-26T08:45:40.000Z","updated_at":"2026-02-18T17:47:18.000Z","dependencies_parsed_at":"2023-12-14T13:40:06.332Z","dependency_job_id":"22690224-0997-4218-8814-a38c55cdd196","html_url":"https://github.com/0x26res/ptars","commit_stats":null,"previous_names":["0x26res/protarrowrs"],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/0x26res/ptars","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x26res%2Fptars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x26res%2Fptars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x26res%2Fptars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x26res%2Fptars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0x26res","download_url":"https://codeload.github.com/0x26res/ptars/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x26res%2Fptars/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29647768,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T09:27:29.698Z","status":"ssl_error","status_checked_at":"2026-02-20T09:26:12.373Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["python","rust"],"created_at":"2026-01-13T22:58:12.467Z","updated_at":"2026-02-20T10:02:47.901Z","avatar_url":"https://github.com/0x26res.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ptars\n\n[![PyPI Version][pypi-image]][pypi-url]\n[![Python Version][versions-image]][versions-url]\n[![PyPI Wheel][wheel-image]][wheel-url]\n[![Documentation][docs-image]][docs-url]\n[![Downloads][downloads-image]][downloads-url]\n[![Downloads][downloads-month-image]][downloads-month-url]\n[![Crates.io][crates-image]][crates-url]\n[![Crates.io Downloads][crates-downloads-image]][crates-url]\n[![docs.rs][docsrs-image]][docsrs-url]\n[![Build Status][build-image]][build-url]\n[![codecov][codecov-image]][codecov-url]\n[![License][license-image]][license-url]\n[![Ruff][ruff-image]][ruff-url]\n[![snyk][snyk-image]][snyk-url]\n[![Github Stars][stars-image]][stars-url]\n[![GitHub issues][github-issues-image]][github-issues-url]\n[![GitHub Release][release-image]][release-url]\n[![Release Date][release-date-image]][release-url]\n[![Last Commit][last-commit-image]][commits-url]\n[![Commit Activity][commit-activity-image]][commits-url]\n[![Open PRs][open-prs-image]][prs-url]\n[![Contributors][contributors-image]][contributors-url]\n[![Contributing][contributing-image]][contributing-url]\n[![FOSSA Status][fossa-image]][fossa-url]\n[![Repo Size][repo-size-image]][repo-size-url]\n[![Rust][rust-image]][rust-url]\n[![Apache Arrow][apache-arrow-image]][apache-arrow-url]\n[![prek][prek-image]][prek-url]\n\n[Repository](https://github.com/0x26res/ptars) |\n[Python Documentation](https://ptars.readthedocs.io/) |\n[Python Installation](https://ptars.readthedocs.io/en/latest/getting-started/#installation) |\n[PyPI](https://pypi.org/project/ptars/) |\n[Rust Crate](https://crates.io/crates/ptars) |\n[Rust Documentation](https://docs.rs/ptars)\n\nFast convertion from Protocol Buffers to Arrow, and back, using Rust, with Python bindings.\n\n## Example\n\nTake a protobuf:\n\n```protobuf\nmessage SearchRequest {\n  string query = 1;\n  int32 page_number = 2;\n  int32 result_per_page = 3;\n}\n```\n\nAnd convert serialized messages directly to `pyarrow.RecordBatch`:\n\n```python\nfrom ptars import HandlerPool\n\n\nmessages = [\n    SearchRequest(\n        query=\"protobuf to arrow\",\n        page_number=0,\n        result_per_page=10,\n    ),\n    SearchRequest(\n        query=\"protobuf to arrow\",\n        page_number=1,\n        result_per_page=10,\n    ),\n]\npayloads = [message.SerializeToString() for message in messages]\n\npool = HandlerPool([SearchRequest.DESCRIPTOR.file])\nhandler = pool.get_for_message(SearchRequest.DESCRIPTOR)\nrecord_batch = handler.list_to_record_batch(payloads)\n```\n\n| query             |   page_number |   result_per_page |\n|:------------------|--------------:|------------------:|\n| protobuf to arrow |             0 |                10 |\n| protobuf to arrow |             1 |                10 |\n\nYou can also convert a `pyarrow.RecordBatch` back to serialized protobuf messages:\n\n```python\narray: pa.BinaryArray = handler.record_batch_to_array(record_batch)\nmessages_back: list[SearchRequest] = [\n    SearchRequest.FromString(s.as_py()) for s in array\n]\n```\n\n## Configuration\n\nCustomize Arrow type mappings with `PtarsConfig`:\n\n```python\nfrom ptars import HandlerPool, PtarsConfig\n\nconfig = PtarsConfig(\n    timestamp_unit=\"us\",  # microseconds instead of nanoseconds\n    timestamp_tz=\"America/New_York\",\n)\n\npool = HandlerPool([SearchRequest.DESCRIPTOR.file], config=config)\n```\n\n## Benchmark against protarrow\n\n[Ptars](https://github.com/0x26res/ptars) is a rust implementation of\n[protarrow](https://github.com/tradewelltech/protarrow),\nwhich is implemented in plain python.\nIt is:\n\n- 2.5 times faster when converting from proto to arrow.\n- 3 times faster when converting from arrow to proto.\n\n```benchmark\n---- benchmark 'to_arrow': 2 tests ----\nName (time in ms)        Mean\n---------------------------------------\nprotarrow_to_arrow     9.4863 (2.63)\nptars_to_arrow         3.6009 (1.0)\n---------------------------------------\n\n---- benchmark 'to_proto': 2 tests -----\nName (time in ms)         Mean\n----------------------------------------\nprotarrow_to_proto     20.8297 (3.20)\nptars_to_proto          6.5013 (1.0)\n----------------------------------------\n```\n\n[pypi-image]: https://img.shields.io/pypi/v/ptars\n[pypi-url]: https://pypi.org/project/ptars/\n[versions-image]: https://img.shields.io/pypi/pyversions/ptars\n[versions-url]: https://pypi.org/project/ptars/\n[wheel-image]: https://img.shields.io/pypi/wheel/ptars\n[wheel-url]: https://pypi.org/project/ptars/\n[docs-image]: https://readthedocs.org/projects/ptars/badge/?version=latest\n[docs-url]: https://ptars.readthedocs.io/en/latest/\n[downloads-image]: https://pepy.tech/badge/ptars\n[downloads-url]: https://static.pepy.tech/badge/ptars\n[downloads-month-image]: https://pepy.tech/badge/ptars/month\n[downloads-month-url]: https://static.pepy.tech/badge/ptars/month\n[build-image]: https://github.com/0x26res/ptars/actions/workflows/ci.yaml/badge.svg\n[build-url]: https://github.com/0x26res/ptars/actions/workflows/ci.yaml\n[codecov-image]: https://codecov.io/gh/0x26res/ptars/branch/main/graph/badge.svg?token=XMFH27IL70\n[codecov-url]: https://codecov.io/gh/0x26res/ptars\n[license-image]: http://img.shields.io/:license-Apache%202-blue.svg\n[license-url]: https://github.com/0x26res/ptars/blob/master/LICENSE\n[ruff-image]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json\n[ruff-url]: https://github.com/astral-sh/ruff\n[snyk-image]: https://snyk.io/test/github/0x26res/ptars/badge.svg\n[snyk-url]: https://snyk.io/advisor/python/ptars\n[stars-image]: https://img.shields.io/github/stars/0x26res/ptars\n[stars-url]: https://github.com/0x26res/ptars\n[github-issues-image]: https://img.shields.io/badge/issue_tracking-github-blue.svg\n[github-issues-url]: https://github.com/0x26res/ptars/issues\n[contributing-image]: https://img.shields.io/badge/PR-Welcome-%23FF8300.svg?\n[contributing-url]: https://github.com/0x26res/ptars/blob/main/DEVELOPMENT.md\n[fossa-image]: https://app.fossa.com/api/projects/git%2Bgithub.com%2F0x26res%2Fptars.svg?type=shield\n[fossa-url]: https://app.fossa.com/projects/git%2Bgithub.com%2F0x26res%2Fptars?ref=badge_shield\n[repo-size-image]: https://img.shields.io/github/repo-size/0x26res/ptars\n[repo-size-url]: https://img.shields.io/github/repo-size/0x26res/ptars\n[crates-image]: https://img.shields.io/crates/v/ptars\n[crates-url]: https://crates.io/crates/ptars\n[crates-downloads-image]: https://img.shields.io/crates/d/ptars\n[docsrs-image]: https://docs.rs/ptars/badge.svg\n[docsrs-url]: https://docs.rs/ptars\n[last-commit-image]: https://img.shields.io/github/last-commit/0x26res/ptars\n[commits-url]: https://github.com/0x26res/ptars/commits/main\n[commit-activity-image]: https://img.shields.io/github/commit-activity/m/0x26res/ptars\n[open-prs-image]: https://img.shields.io/github/issues-pr/0x26res/ptars\n[prs-url]: https://github.com/0x26res/ptars/pulls\n[contributors-image]: https://img.shields.io/github/contributors/0x26res/ptars\n[contributors-url]: https://github.com/0x26res/ptars/graphs/contributors\n[release-image]: https://img.shields.io/github/v/release/0x26res/ptars\n[release-date-image]: https://img.shields.io/github/release-date/0x26res/ptars\n[release-url]: https://github.com/0x26res/ptars/releases\n[rust-image]: https://img.shields.io/badge/rust-%23000000.svg?logo=rust\u0026logoColor=white\n[rust-url]: https://www.rust-lang.org/\n[apache-arrow-image]: https://img.shields.io/badge/Apache%20Arrow-powered-orange.svg\n[apache-arrow-url]: https://arrow.apache.org/\n[prek-image]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/j178/prek/master/docs/assets/badge-v0.json\n[prek-url]: https://github.com/j178/prek\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0x26res%2Fptars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0x26res%2Fptars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0x26res%2Fptars/lists"}