Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

signals

primitives for transparent reactive programming in python

install

pip install signals

usage

from signals import Signal, effect

a = Signal(0)
b = Signal(2)

def c():
    return a() + b()

print(c()) # 2

a.set(1)
print(c()) # 3

b.set(3)
print(c()) # 4

# Log the values of a, b, c whenever one changes
@effect
def log_abc():
    print(a(), b(), c())

a.set(2) # prints (2, 3, 5)

cell magic

we also provide a ipython cell magic %%effect, which offers a convenient way re-execute cells that use signals.

In[1]:

%load_ext signals
from signals import Signal

a = Signal(0)
b = Signal(2)

In[2]:

%%effect
a() + b() # re-evaluates the cell whenever a or b changes

In[3]:

a.set(1)

what

signals is an implementation of transparent reactive programming (TRP) for Python.

TRP is a declarative programming paradigm for expressing relationships between values that vary over time. These time-varying values are known as signals. Whenever a signal changes, the system automatically updates all dependents.

Spreadsheets are the classic example of TRP: cells linked by formulas update automatically when values change. The system discovers dependencies by observing data access, dynamically constructing a dependency graph.

The key features of TRP include:

  • declarative: the programmer specifies relationships between values
  • transparent: the system (not the programmer) automatically tracks dependencies
  • efficient: the system performs only the necessary computations to ensure relationships hold over time

why

TL;DR - TRP is a natural fit for interactive computing but has so far lacked the right interface in popular tools to go mainstream. You can read more of my unfinished thoughts on this topic.

development

this project uses uv for development.

uv run ruff check  # lints code
uv run ruff format # formats code
uv run pytest      # run tests

Download files

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

Source Distribution

signals-0.1.0a5.tar.gz (143.8 kB view details)

Uploaded Source

Built Distribution

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

signals-0.1.0a5-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file signals-0.1.0a5.tar.gz.

File metadata

  • Download URL: signals-0.1.0a5.tar.gz
  • Upload date:
  • Size: 143.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for signals-0.1.0a5.tar.gz
Algorithm Hash digest
SHA256 2a9e748bba9468eddb759f8f752e8ddf439cd69389ac71c47e023237809913ab
MD5 4ed8b348d07608ab62004a2b6e8283a3
BLAKE2b-256 796d44ebbc7980a3d8fb6623ca9012b4cbab40413f1c0ea5194281210c27ccce

See more details on using hashes here.

Provenance

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

Publisher: release.yml on manzt/signals

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

File details

Details for the file signals-0.1.0a5-py3-none-any.whl.

File metadata

  • Download URL: signals-0.1.0a5-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for signals-0.1.0a5-py3-none-any.whl
Algorithm Hash digest
SHA256 858281404c6821ef77e8be48cbcc394b0d4246f617e3fbfc2e73c8c1dfba2c56
MD5 8dc1b630b9b1d9a9f9e8606e28c9fce2
BLAKE2b-256 2cff2aa1e8ffdd82663399e02e8aaadad12f111ff0d735eeb742ef3da2acf6b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for signals-0.1.0a5-py3-none-any.whl:

Publisher: release.yml on manzt/signals

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