🌀 Portal
Fast and reliable distributed systems in Python.
Features
- 📡 Communication: Portal lets you bind functions to a
Serverand call them from one or moreClients. Wait on results viaFutureobjects. Clients can automatically restore broken connections. - 🚀 Performance: Optimized for throughput and latency. Array data is zero-copy serialized and deserialized for throughput near the hardware limit.
- 🤸 Flexibility: Function inputs and outputs can be nested dicts and lists
of numbers, strings, bytes, None values, and Numpy arrays. Bytes allow
applications to chose their own serialization, such as
pickle. - 🚨 Error handlings: Provides
ProcessandThreadobjects that can reliably be killed by the parent. Unhandled exceptions in threads stop the program. Error files can be used to stop distributed systems. - 📦 Request batching: Use
BatchServerto collect multiple incoming requests and process them at once, for example for AI inference servers. Batching and dispatching happens in a separate process to free the GIL. - ✅ Correctness: Covered by over 100 unit tests for common usage and edge cases and used for large scale distributed AI systems.
Installation
pip install portal
Example
This example runs the server and client in the same Python program using subprocesses, but they could also be separate Python scripts running on different machines.
def server():
import portal
server = portal.Server(2222)
server.bind('add', lambda x, y: x + y)
server.bind('greet', lambda msg: print('Message from client:', msg))
server.start()
def client():
import portal
client = portal.Client('localhost:2222')
future = client.add(12, 42)
result = future.result()
print(result) # 54
client.greet('Hello World')
if __name__ == '__main__':
import portal
server_proc = portal.Process(server, start=True)
client_proc = portal.Process(client, start=True)
client_proc.join()
server_proc.kill()
print('Done')
Questions
Please open a separate GitHub issue for each question.
Metadata
Release files for portal 3.8.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| portal-3.8.3.tar.gz | 18.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| portal-3.8.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.7 kB
Release files / portal-3.8.3.tar.gz
| Download URL | portal-3.8.3.tar.gz |
|---|---|
| Size | 18.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
288bcc76637c2cb49007635d57a94dcbfa8bfe21d9e223c6f16ecc1aa3e29ea6
|
|
BLAKE2b-256 checksum How to use checksums |
a8c20b4a87e1c0b0c7059ec313a3dbfbce1877c539e3a58ed2ffe4fb1590a185
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / portal-3.8.3-py3-none-any.whl
| Download URL | portal-3.8.3-py3-none-any.whl |
|---|---|
| Size | 24.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
115761e68ce0cf2421f12ac0280519c647a5d65af3fad9c38904e9f7a04de3ba
|
|
BLAKE2b-256 checksum How to use checksums |
264e3cb88585ca689aae0de3e11f0b483f6dc790ed74845714a221ffeb15a77c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for portal 3.8.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.