Skip to main content

Universal real-time state synchronization for Python (TCP/UDP + Delta Sync).

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 py-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, etc.
  • Hybrid Transport (TCP/UDP): Use UDP for low-latency streaming and TCP for critical state.
  • Delta Sync: Efficient differential encoding for heavy objects (NumPy, Torch) using XOR + Compression.
  • Live Telemetry: Integrated tracking of latency (ms), bandwidth (KB/s), and packet counts.
  • Secure Auth: Protect your SyncServer with custom authentication handlers.
  • High Scalability: Asyncio-based server handling hundreds of concurrent clients.

Examples

The examples/ folder contains several demos:

File Description
remote_host.py / viewer.py NEW: Remote Desktop with UDP & Delta Sync
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
pandas_example.py Collaborative Pandas spreadsheet
federated_learning_example.py Distributed federated learning
genetic_island_example.py Distributed genetic algorithm
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.1.tar.gz (21.3 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.1-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file py_easysync-0.1.1.tar.gz.

File metadata

  • Download URL: py_easysync-0.1.1.tar.gz
  • Upload date:
  • Size: 21.3 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.1.tar.gz
Algorithm Hash digest
SHA256 7420da6f1d74a0ae6b72b9012d9d6fb6a91656622b80c633a2aa42d9fd2a5a3f
MD5 8eafbc854427fca3e4d304960fb0c70d
BLAKE2b-256 2998b16ee3049ba3dfcdf859316ab28f30b08bfd94bef4a8f1f9133d944bb984

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_easysync-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: py_easysync-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0b628477b43f87ba8e8d6bbfc9dc60552f33966db4e3f8941d11141217c88634
MD5 6bad44426dae6c94850a6cb0a7205c0b
BLAKE2b-256 9ff6ba7b7a5864ff325d72d3db8f567449ae46773a8486e0c7f4eef78a767b13

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_easysync-0.1.1-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