spectate


Namespectate JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/rmorshea/spectate
SummaryTrack changes to mutable data types.
upload_time2021-03-05 17:17:48
maintainer
docs_urlNone
authorRyan Morshead
requires_python>=3.6
licenseMIT
keywords eventful callbacks mutable mvc model view controller
VCS
bugtrack_url
requirements twine wheel cmarkgfm furo sphinx-autodoc-typehints pytest flake8 pytest-cov mypy black
Travis-CI
coveralls test coverage No coveralls.
            [![Build Status](https://travis-ci.org/rmorshea/spectate.svg?branch=master)](https://travis-ci.org/rmorshea/spectate/branches)
[![Documentation Status](https://readthedocs.org/projects/python-spectate/badge/?version=latest)](http://python-spectate.readthedocs.io/en/latest/?badge=latest)
[![Version Info](https://img.shields.io/pypi/v/spectate.svg)](https://pypi.python.org/pypi/spectate)

# 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

```bash
pip install spectate
```

+ pre-release

```bash
pip install spectate --pre
```

+ master

```bash
pip install git+https://github.com/rmorshea/spectate.git#egg=spectate
```

+ developer

```bash
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

```python
from spectate import mvc

l = mvc.List()
```

Register a view function to it that observes changes

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

Then modify your object and watch the view function react

```python
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}
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/rmorshea/spectate",
    "name": "spectate",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "eventful,callbacks,mutable,MVC,model,view,controller",
    "author": "Ryan Morshead",
    "author_email": "ryan.morshead@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c8/8d/78dbadaeea943cc0fb9d3cd6b0a4f4668a46f84de1c5507fe3c9f02b8973/spectate-1.0.1.tar.gz",
    "platform": "Linux",
    "description": "[![Build Status](https://travis-ci.org/rmorshea/spectate.svg?branch=master)](https://travis-ci.org/rmorshea/spectate/branches)\n[![Documentation Status](https://readthedocs.org/projects/python-spectate/badge/?version=latest)](http://python-spectate.readthedocs.io/en/latest/?badge=latest)\n[![Version Info](https://img.shields.io/pypi/v/spectate.svg)](https://pypi.python.org/pypi/spectate)\n\n# Spectate\n\nA library for Python 3.6 and above that can track changes to mutable data types.\n\nWith `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.\n\n\n# Documentation\n\nhttps://python-spectate.readthedocs.io/en/latest/\n\n\n# Install\n\n+ stable\n\n```bash\npip install spectate\n```\n\n+ pre-release\n\n```bash\npip install spectate --pre\n```\n\n+ master\n\n```bash\npip install git+https://github.com/rmorshea/spectate.git#egg=spectate\n```\n\n+ developer\n\n```bash\ngit clone https://github.com/rmorshea/spectate && cd spectate/ && pip install -e . -r requirements.txt\n```\n\n\n# At A Glance\n\nIf you're using Python 3.6 and above, create a model object\n\n```python\nfrom spectate import mvc\n\nl = mvc.List()\n```\n\nRegister a view function to it that observes changes\n\n```python\n@mvc.view(l)\ndef printer(l, events):\n    for e in events:\n        print(e)\n```\n\nThen modify your object and watch the view function react\n\n```python\nl.append(0)\nl[0] = 1\nl.extend([2, 3])\n```\n\n```\n{'index': 0, 'old': Undefined, 'new': 0}\n{'index': 0, 'old': 0, 'new': 1}\n{'index': 1, 'old': Undefined, 'new': 2}\n{'index': 2, 'old': Undefined, 'new': 3}\n```\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Track changes to mutable data types.",
    "version": "1.0.1",
    "split_keywords": [
        "eventful",
        "callbacks",
        "mutable",
        "mvc",
        "model",
        "view",
        "controller"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "c759d7f9616f3611ddf3ee7dca229772",
                "sha256": "c4585194c238979f953fbf2ecf9f94c84d9d0a929432c7104e39984f52c9e718"
            },
            "downloads": -1,
            "filename": "spectate-1.0.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c759d7f9616f3611ddf3ee7dca229772",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 11077,
            "upload_time": "2021-03-05T17:17:47",
            "upload_time_iso_8601": "2021-03-05T17:17:47.529708Z",
            "url": "https://files.pythonhosted.org/packages/81/ec/8bdccea3ff7d557601183581340c3768b7bb7b1e32c8991f1130f0c1e2c4/spectate-1.0.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "0da35306b62c71e52a9662bccc16f5a3",
                "sha256": "49a2dde0962fcecf120cb361cc293989489078eb29ba1d8c3d342a741e898b7e"
            },
            "downloads": -1,
            "filename": "spectate-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "0da35306b62c71e52a9662bccc16f5a3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 14573,
            "upload_time": "2021-03-05T17:17:48",
            "upload_time_iso_8601": "2021-03-05T17:17:48.847368Z",
            "url": "https://files.pythonhosted.org/packages/c8/8d/78dbadaeea943cc0fb9d3cd6b0a4f4668a46f84de1c5507fe3c9f02b8973/spectate-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-03-05 17:17:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "rmorshea",
    "github_project": "spectate",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "twine",
            "specs": []
        },
        {
            "name": "wheel",
            "specs": []
        },
        {
            "name": "cmarkgfm",
            "specs": []
        },
        {
            "name": "furo",
            "specs": []
        },
        {
            "name": "sphinx-autodoc-typehints",
            "specs": []
        },
        {
            "name": "pytest",
            "specs": []
        },
        {
            "name": "flake8",
            "specs": []
        },
        {
            "name": "pytest-cov",
            "specs": []
        },
        {
            "name": "mypy",
            "specs": []
        },
        {
            "name": "black",
            "specs": []
        }
    ],
    "tox": true,
    "lcname": "spectate"
}
        
Elapsed time: 0.03092s