{"id":15546727,"url":"https://github.com/danijar/portal","last_synced_at":"2025-04-14T03:13:14.144Z","repository":{"id":191037388,"uuid":"683821801","full_name":"danijar/portal","owner":"danijar","description":"Fast and reliable distributed systems in Python","archived":false,"fork":false,"pushed_at":"2024-09-21T19:48:09.000Z","size":227,"stargazers_count":19,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-09T13:13:56.475Z","etag":null,"topics":["arrays","client","concurrency","distributed","numpy","parallel","parallelism","performance","python","rpc","server","sockets","throughput"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/portal","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/danijar.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":"2023-08-27T20:01:09.000Z","updated_at":"2024-09-21T19:48:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"de77d180-cc1e-4fdb-8ac6-ce88540bdca3","html_url":"https://github.com/danijar/portal","commit_stats":{"total_commits":106,"total_committers":1,"mean_commits":106.0,"dds":0.0,"last_synced_commit":"7c50a214b2c1c4396f250edf99f6c84840900adb"},"previous_names":["danijar/zerofun","danijar/portal"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danijar%2Fportal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danijar%2Fportal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danijar%2Fportal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danijar%2Fportal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danijar","download_url":"https://codeload.github.com/danijar/portal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248813802,"owners_count":21165634,"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":["arrays","client","concurrency","distributed","numpy","parallel","parallelism","performance","python","rpc","server","sockets","throughput"],"created_at":"2024-10-02T13:03:57.676Z","updated_at":"2025-04-14T03:13:14.115Z","avatar_url":"https://github.com/danijar.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![PyPI](https://img.shields.io/pypi/v/portal.svg)](https://pypi.python.org/pypi/portal/#history)\n\n# 🌀 Portal\n\nFast and reliable distributed systems in Python.\n\n## Features\n\n- 📡 **Communication:** Portal lets you bind functions to a `Server` and call\n  them from one or more `Client`s. Wait on results via `Future` objects.\n  Clients can automatically restore broken connections.\n- 🚀 **Performance:** Optimized for throughput and latency. Array data is\n  zero-copy serialized and deserialized for throughput near the hardware limit.\n- 🤸 **Flexibility:** Function inputs and outputs can be nested dicts and lists\n  of numbers, strings, bytes, None values, and Numpy arrays. Bytes allow\n  applications to chose their own serialization, such as `pickle`.\n- 🚨 **Error handlings:** Provides `Process` and `Thread` objects that can\n  reliably be killed by the parent. Unhandled exceptions in threads stop\n  the program. Error files can be used to stop distributed systems.\n- 📦 **Request batching:** Use `BatchServer` to collect multiple incoming\n  requests and process them at once, for example for AI inference servers.\n  Batching and dispatching happens in a separate process to free the GIL.\n- ✅ **Correctness:** Covered by over 100 unit tests for common usage and edge\n  cases and used for large scale distributed AI systems.\n\n## Installation\n\n```sh\npip install portal\n```\n\n## Example\n\nThis example runs the server and client in the same Python program using\nsubprocesses, but they could also be separate Python scripts running on\ndifferent machines.\n\n```python\ndef server():\n  import portal\n  server = portal.Server(2222)\n  server.bind('add', lambda x, y: x + y)\n  server.bind('greet', lambda msg: print('Message from client:', msg))\n  server.start()\n\ndef client():\n  import portal\n  client = portal.Client('localhost:2222')\n  future = client.add(12, 42)\n  result = future.result()\n  print(result)  # 54\n  client.greet('Hello World')\n\nif __name__ == '__main__':\n  import portal\n  server_proc = portal.Process(server, start=True)\n  client_proc = portal.Process(client, start=True)\n  client_proc.join()\n  server_proc.kill()\n  print('Done')\n```\n\n## Questions\n\nPlease open a separate [GitHub issue](https://github.com/danijar/portal/issues)\nfor each question.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanijar%2Fportal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanijar%2Fportal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanijar%2Fportal/lists"}