Skip to main content

Build Status Documentation Status Version Info

Spectate

A library for Python 3.6 and above that can track changes to mutable data types.

With spectate, complicated protocols for managing updates don't need to be the outward responsibility of a user and can instead be done automagically in the background. For instance, syncing the state between a server and client can controlled by spectate, so users don't have to.

Documentation

https://python-spectate.readthedocs.io/en/latest/

Install

  • stable
pip install spectate
  • pre-release
pip install spectate --pre
  • master
pip install git+https://github.com/rmorshea/spectate.git#egg=spectate
  • developer
git clone https://github.com/rmorshea/spectate && cd spectate/ && pip install -e . -r requirements.txt

At A Glance

If you're using Python 3.6 and above, create a model object

from spectate import mvc

l = mvc.List()

Register a view function to it that observes changes

@mvc.view(l)
def printer(l, events):
    for e in events:
        print(e)

Then modify your object and watch the view function react

l.append(0)
l[0] = 1
l.extend([2, 3])
{'index': 0, 'old': Undefined, 'new': 0}
{'index': 0, 'old': 0, 'new': 1}
{'index': 1, 'old': Undefined, 'new': 2}
{'index': 2, 'old': Undefined, 'new': 3}

Metadata

Release files for spectate 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spectate 1.0.1
File Size Uploaded
spectate-1.0.1.tar.gz 14.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spectate 1.0.1
File Interpreter ABI Platform
spectate-1.0.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 25.6 kB

Release files / spectate-1.0.1.tar.gz

Download URL spectate-1.0.1.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
49a2dde0962fcecf120cb361cc293989489078eb29ba1d8c3d342a741e898b7e
BLAKE2b-256 checksum
How to use checksums
c88d78dbadaeea943cc0fb9d3cd6b0a4f4668a46f84de1c5507fe3c9f02b8973
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

Release files / spectate-1.0.1-py2.py3-none-any.whl

Download URL spectate-1.0.1-py2.py3-none-any.whl
Size 11.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c4585194c238979f953fbf2ecf9f94c84d9d0a929432c7104e39984f52c9e718
BLAKE2b-256 checksum
How to use checksums
81ec8bdccea3ff7d557601183581340c3768b7bb7b1e32c8991f1130f0c1e2c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page