Universal real-time state synchronization for Python.
Project description
EasySync
Universal real-time state synchronization for Python.
Manipulate your Python objects as if the network didn't exist. EasySync intercepts attribute mutations through a transparent proxy and propagates them instantly to all machines connected to the server.
Installation
pip install easysync
Quick Start
Server (hosts the shared state):
from easysync import SyncedObject, SyncServer, connect
server = SyncServer(port=5000)
server.start_thread()
client = connect("127.0.0.1", 5000)
@SyncedObject(client)
class GameState:
def __init__(self):
self.score = 0
self.players = []
state = GameState()
state.score = 42 # propagated to all clients
state.players.append("A") # propagated too
Client (joins the server):
from easysync import SyncedObject, connect
client = connect("192.168.1.10", 5000)
@SyncedObject(client)
class GameState:
def __init__(self):
self.score = 0
self.players = []
state = GameState()
print(state.score) # 42, updated in real time
print(state.players) # ['A']
Architecture
The server uses asyncio for non-blocking connection handling, allowing it to support a large number of simultaneous clients without CPU overhead. The client uses a dedicated receive thread to remain compatible with standard application loops (Pygame, Matplotlib, etc.).
The wire protocol relies on binary Pickle serialization framed by a 4-byte header (payload size). This ensures measured latency under 20ms.
Features
- Zero configuration: a single
@SyncedObjectdecorator is all you need. - Transparent proxy: automatic interception of
__setattr__,__setitem__,append,pop, etc. - Asyncio server: built on
asyncio.start_serverfor maximum scalability. - Binary serialization: Pickle + TCP framing protocol, latency < 20ms.
- Zero dependencies: only uses the Python standard library.
- Data Science ready: optimized handling of NumPy, Pandas and Scikit-Learn objects via the copy-and-reassign pattern.
Examples
The examples/ folder contains several demos:
| File | Description |
|---|---|
pygame_example.py |
Synchronized square between two Pygame windows |
pygame_hanoi.py |
Collaborative Tower of Hanoi |
numpy_matplotlib_example.py |
NumPy data streaming with Matplotlib chart |
pandas_example.py |
Collaborative Pandas spreadsheet |
sklearn_live_training.py |
Live Scikit-Learn training visualization |
federated_learning_example.py |
Distributed federated learning |
genetic_island_example.py |
Distributed genetic algorithm (island model) |
tetris_ai_example.py |
Distributed Tetris AI via genetic algorithm |
To run the examples, install the additional dependencies:
pip install -r requirements_examples.txt
Then launch a server and one or more clients:
python examples/pygame_example.py server # Terminal 1
python examples/pygame_example.py # Terminal 2
License
MIT
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_easysync-0.1.0.tar.gz.
File metadata
- Download URL: py_easysync-0.1.0.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
199e946748fafd7e227fc60741009ec450808cf52882c7efb6e85676e33e511c
|
|
| MD5 |
8a24a938fd90e58a5af894034967b1e4
|
|
| BLAKE2b-256 |
4f540de568ae43f4966444b2eca39b30bd82ed9a6aaf78c729c3a7a6e85a95b3
|
Provenance
The following attestation bundles were made for py_easysync-0.1.0.tar.gz:
Publisher:
publish-to-pypi.yml on GalTechDev/easysync
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_easysync-0.1.0.tar.gz -
Subject digest:
199e946748fafd7e227fc60741009ec450808cf52882c7efb6e85676e33e511c - Sigstore transparency entry: 1248859815
- Sigstore integration time:
-
Permalink:
GalTechDev/easysync@822b698666a1c30293f0b214a9c7eb1402bad8ad -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/GalTechDev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@822b698666a1c30293f0b214a9c7eb1402bad8ad -
Trigger Event:
release
-
Statement type:
File details
Details for the file py_easysync-0.1.0-py3-none-any.whl.
File metadata
- Download URL: py_easysync-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7e3d616d3e28e47ae6fe4d8836fa0568dda9e6ea1914ac92e95dc06e66bcc5e
|
|
| MD5 |
b5ff2f3e2af9384da2ea4ea7a85498b8
|
|
| BLAKE2b-256 |
6592afd8f64dde08d2002b0d71b7664a9ee86165942e9dca4c2f76d661cdfa22
|
Provenance
The following attestation bundles were made for py_easysync-0.1.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on GalTechDev/easysync
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_easysync-0.1.0-py3-none-any.whl -
Subject digest:
e7e3d616d3e28e47ae6fe4d8836fa0568dda9e6ea1914ac92e95dc06e66bcc5e - Sigstore transparency entry: 1248859849
- Sigstore integration time:
-
Permalink:
GalTechDev/easysync@822b698666a1c30293f0b214a9c7eb1402bad8ad -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/GalTechDev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@822b698666a1c30293f0b214a9c7eb1402bad8ad -
Trigger Event:
release
-
Statement type: