Fast and reliable distributed systems in Python
Project description
🌪️ Twist
Fast and reliable distributed systems in Python.
Installation
pip install twist
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 twist
server = twist.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 twist
client = twist.Client('localhost', 2222)
future = client.add(12, 42)
result = future.result()
print(result) # 54
client.greet('Hello World')
if __name__ == '__main__':
import twist
server_proc = twist.Process(server, start=True)
client_proc = twist.Process(client, start=True)
client_proc.join()
server_proc.kill()
print('Done')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
twist-0.1.0.tar.gz
(25.4 kB
view details)
File details
Details for the file twist-0.1.0.tar.gz.
File metadata
- Download URL: twist-0.1.0.tar.gz
- Upload date:
- Size: 25.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1de4d9283f65f2632d306f451e9fb9b1ec04476cae00b487ba3af45b7ce04c1a
|
|
| MD5 |
b798b2798d08b21bfc69ccf88cd8b7ec
|
|
| BLAKE2b-256 |
1c9f1b3a272b8df3ff9772e4eaede6f88e61ad8fb379c05938016d9979cfab47
|