signified


Namesignified JSON
Version 0.1.5 PyPI version JSON
download
home_pageNone
SummaryReactive Signals and Computed values.
upload_time2024-10-13 00:53:23
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseBSD 3-Clause License Copyright (c) 2024, Doug Mercer Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords reactive signals
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Signified

[![PyPI - Downloads](https://img.shields.io/pypi/dw/signified)](https://pypi.org/project/signified/)
[![PyPI - Version](https://img.shields.io/pypi/v/signified)](https://pypi.org/project/signified/)
[![Tests Status](https://github.com/dougmercer/signified/actions/workflows/test.yml/badge.svg)](https://github.com/dougmercer/signified/actions/workflows/test.yml?query=branch%3Amain)

---

**Documentation**: [https://dougmercer.github.io/signified](https://dougmercer.github.io/signified)

**Source Code**: [https://github.com/dougmercer/signified](https://github.com/dougmercer/signified)

---

A Python library for reactive programming (with kind-of working type narrowing).

## Getting started

```bash
pip install signified
```

## Why care?

`signified` is a reactive programming library that implements two primary data structures: `Signal` and `Computed`.

Both of these objects implement the *Observer* and *Observable* design patterns. This means that they can notify
other *Observers* if they change, and they can subscribe to be notified if another *Observable* changes.

This allows us to create a network of computation, where one value being modified can trigger other objects to update.

This allows us to write more declarative code, like,

```python
x = Signal(3)
x_squared = x ** 2  # currently equal to 9
x.value = 10  # Will immediately notify x_squared, whose value will become 100.
```

Here, `x_squared` became a reactive expression (more specifically, a `Computed` object) whose value is always equal to `x ** 2`. Neat!

`signified`'s `Signal` object effective gives us a container which stores a value, and `Computed` gives us a container to store the current value of a function. In the above example, we generated the Computed object on-the-fly using overloaded Python operators like `**`, but we could have just as easily done,

```python
from signified import computed

@computed
def power(x, n):
    return x**n

x_squared = power(x, 2)  # equivalent to the above
```

Together, these data structures allow us to implement a wide variety of capabilities. In particular, I wrote this library to make my to-be-released animation library easier to maintain and more fun to work with.

## ... what do you mean by "kind of working type narrowing"?

Other reactive Python libraries don't really attempt to implement type hints (e.g., [param](https://param.holoviz.org/)).

``signified`` is type hinted and supports type narrowing even for nested reactive values.

```python
from signified import Signal

a = Signal(1.0)
b = Signal(Signal(Signal(2)))
reveal_type(a + b)  # Computed[float | int]
```

Unfortunately, for the time being, our type hints only work with ``pyright``.

## Read the docs!

Checkout [https://dougmercer.github.io/signified](https://dougmercer.github.io/signified) to find out more.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "signified",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Doug Mercer <dougmerceryt@gmail.com>",
    "keywords": "reactive, signals",
    "author": null,
    "author_email": "Doug Mercer <dougmerceryt@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/51/07/4cc4bfda805e800d43fc7e22cff825f0ecda0d9aa44aff1503fc34b74c66/signified-0.1.5.tar.gz",
    "platform": null,
    "description": "# Signified\n\n[![PyPI - Downloads](https://img.shields.io/pypi/dw/signified)](https://pypi.org/project/signified/)\n[![PyPI - Version](https://img.shields.io/pypi/v/signified)](https://pypi.org/project/signified/)\n[![Tests Status](https://github.com/dougmercer/signified/actions/workflows/test.yml/badge.svg)](https://github.com/dougmercer/signified/actions/workflows/test.yml?query=branch%3Amain)\n\n---\n\n**Documentation**: [https://dougmercer.github.io/signified](https://dougmercer.github.io/signified)\n\n**Source Code**: [https://github.com/dougmercer/signified](https://github.com/dougmercer/signified)\n\n---\n\nA Python library for reactive programming (with kind-of working type narrowing).\n\n## Getting started\n\n```bash\npip install signified\n```\n\n## Why care?\n\n`signified` is a reactive programming library that implements two primary data structures: `Signal` and `Computed`.\n\nBoth of these objects implement the *Observer* and *Observable* design patterns. This means that they can notify\nother *Observers* if they change, and they can subscribe to be notified if another *Observable* changes.\n\nThis allows us to create a network of computation, where one value being modified can trigger other objects to update.\n\nThis allows us to write more declarative code, like,\n\n```python\nx = Signal(3)\nx_squared = x ** 2  # currently equal to 9\nx.value = 10  # Will immediately notify x_squared, whose value will become 100.\n```\n\nHere, `x_squared` became a reactive expression (more specifically, a `Computed` object) whose value is always equal to `x ** 2`. Neat!\n\n`signified`'s `Signal` object effective gives us a container which stores a value, and `Computed` gives us a container to store the current value of a function. In the above example, we generated the Computed object on-the-fly using overloaded Python operators like `**`, but we could have just as easily done,\n\n```python\nfrom signified import computed\n\n@computed\ndef power(x, n):\n    return x**n\n\nx_squared = power(x, 2)  # equivalent to the above\n```\n\nTogether, these data structures allow us to implement a wide variety of capabilities. In particular, I wrote this library to make my to-be-released animation library easier to maintain and more fun to work with.\n\n## ... what do you mean by \"kind of working type narrowing\"?\n\nOther reactive Python libraries don't really attempt to implement type hints (e.g., [param](https://param.holoviz.org/)).\n\n``signified`` is type hinted and supports type narrowing even for nested reactive values.\n\n```python\nfrom signified import Signal\n\na = Signal(1.0)\nb = Signal(Signal(Signal(2)))\nreveal_type(a + b)  # Computed[float | int]\n```\n\nUnfortunately, for the time being, our type hints only work with ``pyright``.\n\n## Read the docs!\n\nCheckout [https://dougmercer.github.io/signified](https://dougmercer.github.io/signified) to find out more.\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License  Copyright (c) 2024, Doug Mercer  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
    "summary": "Reactive Signals and Computed values.",
    "version": "0.1.5",
    "project_urls": {
        "Changelog": "https://dougmercer.github.io/signified/changelog",
        "Documentation": "https://dougmercer.github.io/signified",
        "Homepage": "https://github.com/dougmercer/signified.git",
        "Issues": "https://github.com/dougmercer/signified/issues",
        "Repository": "https://github.com/dougmercer/signified.git"
    },
    "split_keywords": [
        "reactive",
        " signals"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "daff85d0c050e3d701a4bebf3c38ff917d05b0d77de4ad631bbd16092acc2694",
                "md5": "44de6eed7fabfc367c8b5b61c00772ad",
                "sha256": "f00491cc2797d1a013d42fd253c7ca4aeaf88d05d914bc2901ceaad1aac71ed1"
            },
            "downloads": -1,
            "filename": "signified-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "44de6eed7fabfc367c8b5b61c00772ad",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 12286,
            "upload_time": "2024-10-13T00:53:21",
            "upload_time_iso_8601": "2024-10-13T00:53:21.818176Z",
            "url": "https://files.pythonhosted.org/packages/da/ff/85d0c050e3d701a4bebf3c38ff917d05b0d77de4ad631bbd16092acc2694/signified-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "51074cc4bfda805e800d43fc7e22cff825f0ecda0d9aa44aff1503fc34b74c66",
                "md5": "ff66c59b59f6c65725c5d42b8c8ca0b4",
                "sha256": "6a60ddd64781c17041c43e46838aa83069a2b22a3d9eba67d21c18349964db03"
            },
            "downloads": -1,
            "filename": "signified-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "ff66c59b59f6c65725c5d42b8c8ca0b4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 16471,
            "upload_time": "2024-10-13T00:53:23",
            "upload_time_iso_8601": "2024-10-13T00:53:23.413438Z",
            "url": "https://files.pythonhosted.org/packages/51/07/4cc4bfda805e800d43fc7e22cff825f0ecda0d9aa44aff1503fc34b74c66/signified-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-13 00:53:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dougmercer",
    "github_project": "signified",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "signified"
}
        
Elapsed time: 0.38867s