Skip to main content

Universal real-time state synchronization for Python.

Project description

EasySync

Universal real-time state synchronization for Python.

Python License

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 @SyncedObject decorator is all you need.
  • Transparent proxy: automatic interception of __setattr__, __setitem__, append, pop, etc.
  • Asyncio server: built on asyncio.start_server for 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_easysync-0.1.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_easysync-0.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

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

Hashes for py_easysync-0.1.0.tar.gz
Algorithm Hash digest
SHA256 199e946748fafd7e227fc60741009ec450808cf52882c7efb6e85676e33e511c
MD5 8a24a938fd90e58a5af894034967b1e4
BLAKE2b-256 4f540de568ae43f4966444b2eca39b30bd82ed9a6aaf78c729c3a7a6e85a95b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_easysync-0.1.0.tar.gz:

Publisher: publish-to-pypi.yml on GalTechDev/easysync

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for py_easysync-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e7e3d616d3e28e47ae6fe4d8836fa0568dda9e6ea1914ac92e95dc06e66bcc5e
MD5 b5ff2f3e2af9384da2ea4ea7a85498b8
BLAKE2b-256 6592afd8f64dde08d2002b0d71b7664a9ee86165942e9dca4c2f76d661cdfa22

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page