Skip to main content

Fast python callback/event system modeled after Qt Signals

Project description

psygnal

License PyPI Conda Python Version CI codecov Documentation Status

Psygnal (pronounced "signal") is a pure python implementation of Qt-style Signals with (optional) signature and type checking, and support for threading.

Note: this library does not require Qt. It just implements a similar pattern of inter-object communication with loose coupling.

Documentation

https://psygnal.readthedocs.io/

Install

pip install psygnal
conda install -c conda-forge psygnal

Usage

A very simple example:

from psygnal import Signal

class MyObject:
    value_changed = Signal(str)
    shutting_down = Signal()

my_obj = MyObject()

@my_obj.value_changed.connect
def on_change(new_value: str):
    print(f"The value changed to {new_value}!")

my_obj.value_changed.emit('hi')

Much more detail available in the documentation!

Evented Dataclasses

A particularly nice usage of the signal pattern is to emit signals whenever a field of a dataclass changes. Psygnal provides an @evented decorator that will emit a signal whenever a field changes. It is compatible with dataclasses from the standard library, as well as attrs, and pydantic:

from psygnal import evented
from dataclasses import dataclass

@evented
@dataclass
class Person:
    name: str
    age: int = 0

person = Person('John', age=30)

# connect callbacks
@person.events.age.connect
def _on_age_change(new_age: str):
    print(f"Age changed to {new_age}")

person.age = 31  # prints: Age changed to 31

See the dataclass documentation for more details.

Benchmark history

https://pyapp-kit.github.io/psygnal/

Developers

Debugging

While psygnal is a pure python module, it is compiled with Cython to increase performance. To import psygnal in uncompiled mode, without deleting the shared library files from the psyngal module, set the environment variable PSYGNAL_UNCOMPILED before importing psygnal. The psygnal._compiled variable will tell you if you're running the compiled library or not.

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

psygnal-0.7.1.tar.gz (62.6 kB view details)

Uploaded Source

Built Distributions

psygnal-0.7.1-py3-none-any.whl (49.1 kB view details)

Uploaded Python 3

psygnal-0.7.1-cp311-cp311-win_amd64.whl (227.7 kB view details)

Uploaded CPython 3.11 Windows x86-64

psygnal-0.7.1-cp311-cp311-musllinux_1_1_x86_64.whl (449.1 kB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

psygnal-0.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (470.7 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

psygnal-0.7.1-cp311-cp311-macosx_10_16_x86_64.whl (298.9 kB view details)

Uploaded CPython 3.11 macOS 10.16+ x86-64

psygnal-0.7.1-cp311-cp311-macosx_10_16_arm64.whl (275.2 kB view details)

Uploaded CPython 3.11 macOS 10.16+ ARM64

psygnal-0.7.1-cp310-cp310-win_amd64.whl (223.2 kB view details)

Uploaded CPython 3.10 Windows x86-64

psygnal-0.7.1-cp310-cp310-musllinux_1_1_x86_64.whl (453.9 kB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

psygnal-0.7.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (472.7 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

psygnal-0.7.1-cp310-cp310-macosx_10_16_x86_64.whl (302.1 kB view details)

Uploaded CPython 3.10 macOS 10.16+ x86-64

psygnal-0.7.1-cp310-cp310-macosx_10_16_arm64.whl (279.3 kB view details)

Uploaded CPython 3.10 macOS 10.16+ ARM64

psygnal-0.7.1-cp39-cp39-win_amd64.whl (222.8 kB view details)

Uploaded CPython 3.9 Windows x86-64

psygnal-0.7.1-cp39-cp39-musllinux_1_1_x86_64.whl (449.8 kB view details)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

psygnal-0.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (469.9 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

psygnal-0.7.1-cp39-cp39-macosx_10_16_x86_64.whl (302.0 kB view details)

Uploaded CPython 3.9 macOS 10.16+ x86-64

psygnal-0.7.1-cp39-cp39-macosx_10_16_arm64.whl (279.2 kB view details)

Uploaded CPython 3.9 macOS 10.16+ ARM64

psygnal-0.7.1-cp38-cp38-win_amd64.whl (219.5 kB view details)

Uploaded CPython 3.8 Windows x86-64

psygnal-0.7.1-cp38-cp38-musllinux_1_1_x86_64.whl (447.8 kB view details)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

psygnal-0.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (452.8 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

psygnal-0.7.1-cp38-cp38-macosx_10_16_x86_64.whl (299.3 kB view details)

Uploaded CPython 3.8 macOS 10.16+ x86-64

psygnal-0.7.1-cp38-cp38-macosx_10_16_arm64.whl (276.4 kB view details)

Uploaded CPython 3.8 macOS 10.16+ ARM64

psygnal-0.7.1-cp37-cp37m-win_amd64.whl (211.8 kB view details)

Uploaded CPython 3.7m Windows x86-64

psygnal-0.7.1-cp37-cp37m-musllinux_1_1_x86_64.whl (354.1 kB view details)

Uploaded CPython 3.7m musllinux: musl 1.1+ x86-64

psygnal-0.7.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (358.4 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

psygnal-0.7.1-cp37-cp37m-macosx_10_16_x86_64.whl (288.1 kB view details)

Uploaded CPython 3.7m macOS 10.16+ x86-64

File details

Details for the file psygnal-0.7.1.tar.gz.

File metadata

  • Download URL: psygnal-0.7.1.tar.gz
  • Upload date:
  • Size: 62.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for psygnal-0.7.1.tar.gz
Algorithm Hash digest
SHA256 830379b19be0e2b7be93d1ccdeb1e03209d3e3aec6e2697844ae551f780f6915
MD5 f70d3b5d0a55c4fd28d99d9fd3bb9e44
BLAKE2b-256 808912bca3a40591a6273e0d94cb4e686cc530a367ea7ae7be2f0ad986678bb1

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: psygnal-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 49.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for psygnal-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e4f3b29248c3858699d13d12ae893ed7e09dba94ec35700e33cff895f2889144
MD5 c0fb60e24a2001c81d7e4e14539f2c68
BLAKE2b-256 fb56e53f4b53a289945dc152238a1c0d6edbf4f0f41eb8d73453fcb70e2d7a77

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: psygnal-0.7.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 227.7 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.9

File hashes

Hashes for psygnal-0.7.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 44903b7ddfb164022142f9cc6fdff33c6655a0c60385ae117b439005a53533af
MD5 b9b845d9184e45cd51711c3c4dc90697
BLAKE2b-256 40cf55c50453437107b6751d26c9027ddd63eefd15c1bb0c1b0d2dcf4c7590b2

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp311-cp311-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for psygnal-0.7.1-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 36edd6db98453e2222260d48e391cb441f5f72a6863c83ff6198773178161eef
MD5 526428f4dbf7aa0d27dcf1a839cc10ee
BLAKE2b-256 05c12d31a69417210a8a1fe50a5be59f69620febfe73d489819a3debac3e0d78

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for psygnal-0.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 613a31500632b89f395c25a864cc7ad26b0db61e593bbf7df086ca074d47f50e
MD5 6acf6939ce918180abdcf54869fbf404
BLAKE2b-256 a62f3c8b30632a34c1d7d371d1a65ade34fdd90c6791ef67d028a1f12d4a54fc

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp311-cp311-macosx_10_16_x86_64.whl.

File metadata

File hashes

Hashes for psygnal-0.7.1-cp311-cp311-macosx_10_16_x86_64.whl
Algorithm Hash digest
SHA256 4480b818030a01741805760362ae8fddb67c2ba0ba9bcf59e63675fcbe514752
MD5 9730fb873c1e5dda742602ed9f56cb4c
BLAKE2b-256 9198148abe6e30c94e510d78c078ace72b550cda237d48b90022bfd440690b11

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp311-cp311-macosx_10_16_arm64.whl.

File metadata

File hashes

Hashes for psygnal-0.7.1-cp311-cp311-macosx_10_16_arm64.whl
Algorithm Hash digest
SHA256 1ed6eff4dc58b7b2feda97ae730e89bf65d1a0542acef1ae0d8dbbe0fb5a35f6
MD5 ce18192388e5b50cf6e554a9909c22c4
BLAKE2b-256 e73875fd65c696e21f15da9e69364a9ab9f6f9233d67ffa18b58563aa165e014

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: psygnal-0.7.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 223.2 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.9

File hashes

Hashes for psygnal-0.7.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a65a2fb8d56d5f4b9e0cd7dcd96cba0607d9a7a0bc1f017c64e5b32d63b07cc0
MD5 fd836e42ad1c6ea228c578c09798024d
BLAKE2b-256 d32c4d3d67bb998516bc989d84071a9ebb5e956ed2873b663e7ddaa2fdcd96d0

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp310-cp310-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for psygnal-0.7.1-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 f3eb0ab6314c72b5e11b088fe29de04a92d919e37ef714d29af29e3907f3ba69
MD5 0a3ab71fdc010474b069f5655646d59a
BLAKE2b-256 a33e9db78b9a3fabb458fbb695c40c281f63a6c665268fcd55729be0727dc4b6

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for psygnal-0.7.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4b2c927770c218c4497c551b86ec536d4e77205b2972d62d1476d6fe04913727
MD5 95e0d83398d9c822f0321c32c9678ebe
BLAKE2b-256 f8abbe3ca6933de2b40fe70b0e39dfbc69ee081f21d4409bd638c25ffdd8a4c2

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp310-cp310-macosx_10_16_x86_64.whl.

File metadata

File hashes

Hashes for psygnal-0.7.1-cp310-cp310-macosx_10_16_x86_64.whl
Algorithm Hash digest
SHA256 ec7b65d2e854b4d01556952bfb725eaff64845e5ca76cf7c57c183ac1e623844
MD5 2544d8f9d5e09391911ad48e131ecda3
BLAKE2b-256 8f553200dca2982adb6250d9dfff4bfb33644a33bb5eddd6e1d4fda43c2ddf3d

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp310-cp310-macosx_10_16_arm64.whl.

File metadata

File hashes

Hashes for psygnal-0.7.1-cp310-cp310-macosx_10_16_arm64.whl
Algorithm Hash digest
SHA256 9b06a6f1e102c029ec5dda6963816ab8a6c0aef51fb06099b53bccd415411222
MD5 fb1765c1c60e4a1a6ba1dbd1548454e0
BLAKE2b-256 b226b9fb8bd39eea6baa4e56ac15d05357214fd657ac379a24c1d4d1aa37a48b

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: psygnal-0.7.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 222.8 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.9

File hashes

Hashes for psygnal-0.7.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 a18ea08b2cb096d59240ab14b2df3c770318584c4b3ed3a707891f3fa48159d8
MD5 c3c0f8dd4fe4de73736f9f7f3df036eb
BLAKE2b-256 0bf340eb47a34e49cb78e247a172ff3c9ff800beff79ddcafa41694590ab150f

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp39-cp39-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for psygnal-0.7.1-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 1388e7ab422bfe2cc673ba761c37cd04b0e2b83c5c9d30be35fbd54fb734a5c2
MD5 1c236572d7797506d75f31883245f42c
BLAKE2b-256 e3fc72b80fbd44c1a1a58fe18fe0f84a099bc139a7329fcf03b33323738699df

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for psygnal-0.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 39995869c024e80f7836f0158c5c0f34ebcec0e1996f10586ca76f9f54214e22
MD5 eae19f62766364fd1e09135a88ae70fa
BLAKE2b-256 c059384ff9b2c0a095578e4f2e848f03f9bef374879337c0f932ce21274bafbe

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp39-cp39-macosx_10_16_x86_64.whl.

File metadata

File hashes

Hashes for psygnal-0.7.1-cp39-cp39-macosx_10_16_x86_64.whl
Algorithm Hash digest
SHA256 62d0f2db304e02a27321a75304eb4f68c430f1e59d853a37aa3a57fcc78c315e
MD5 375409cbe2c4a8b91a7385a7fa36e3d5
BLAKE2b-256 d65382181770a09b75b0917175f96acff5c504307e490fe5739e3fc36ec7992a

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp39-cp39-macosx_10_16_arm64.whl.

File metadata

File hashes

Hashes for psygnal-0.7.1-cp39-cp39-macosx_10_16_arm64.whl
Algorithm Hash digest
SHA256 4d60400297ba6a1a4ae6c8be4d74cfcce75a97716a95bd0c53fe10920dd80f26
MD5 ee0e3c939c13ac1b0865e6287bf61a6a
BLAKE2b-256 193ff9d08e038c9ae44d514edb3eec5806687d3883e7cf44800094ac5a000f2c

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: psygnal-0.7.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 219.5 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.9

File hashes

Hashes for psygnal-0.7.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 32a86d18cca7554338ec4285750eba6c3d0441915bec36991d4c65fbc995e211
MD5 ac5d63b7b7bccde3bcef3e48d868b4bc
BLAKE2b-256 3d7249514a66684bf1b92c91bc8df569bc9668d354b8ecaa2c3376168278d96d

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp38-cp38-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for psygnal-0.7.1-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 c90fa6bc68664596cf06c575a2898525f9f63c210897cbcaaa9267b994d03154
MD5 fc509aa9ee52f61ebe217b00b1189a5a
BLAKE2b-256 8dc217f1f88055708aa6ee236db23057f4c480d9ee0eeb4f5c52be53389924ad

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for psygnal-0.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a4bcbd15bd58a9364291a1baf75b1e4e4d8c87150204241e9fd14d24c7e418e6
MD5 415b04262cd97c34deffd55e874441a8
BLAKE2b-256 96db80e6c3b84383adb9f7d1634686bf3ea13d8514dc895e124d9f85f0fd9882

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp38-cp38-macosx_10_16_x86_64.whl.

File metadata

File hashes

Hashes for psygnal-0.7.1-cp38-cp38-macosx_10_16_x86_64.whl
Algorithm Hash digest
SHA256 e63e4cece2f6c8dc2015b6f0e6d4af79ccb71af6fa767a352c87d9fb97020884
MD5 a0486dc6631aee48b14dd5d254410327
BLAKE2b-256 a3eb0974dedd5b8a943c8197fb44b9323ba1663a6f06090da2d8277c6e56c81a

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp38-cp38-macosx_10_16_arm64.whl.

File metadata

File hashes

Hashes for psygnal-0.7.1-cp38-cp38-macosx_10_16_arm64.whl
Algorithm Hash digest
SHA256 7efbae225712e7f48bee19a476c73083bf2f2453d15524937390621d860acf89
MD5 fd3820268fa6692b59ea0138cda62593
BLAKE2b-256 b0776562638034478423d07f34c87cd0962c05b1aafbecd7e9148aa2453c14a1

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: psygnal-0.7.1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 211.8 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.9

File hashes

Hashes for psygnal-0.7.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 285318ea3de8ae3377fbf04dfc001bd7b47ae6a8eeb4e29840b7e7cc99f91d69
MD5 84e88a740717590265d1224b139ab2ec
BLAKE2b-256 11c872a924d4a573c8fa38b8d59fbf71b87637f7da8b71e4d1e9d84de2b87b1e

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp37-cp37m-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for psygnal-0.7.1-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 46d84ff51894787aa15a21ca2bdf2b28e6f869f1f227981356b121caeeaf0c64
MD5 df6ff4d30ceb1a19d7279eeb4ab2c189
BLAKE2b-256 240b258d92887e8675395220c39a6ad4055beca4c8e7fd247c91d4f13e48440d

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for psygnal-0.7.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3466eea4c8872806de8310a45c01ce60e51f0363c27233f30130b9d93c15e781
MD5 f5612b7fbced69b003abfdde37e107aa
BLAKE2b-256 f1f7a6b53185338cdc304a9d9742a6fa3eb145b9f9a0f6e82b16842ed495ab71

See more details on using hashes here.

File details

Details for the file psygnal-0.7.1-cp37-cp37m-macosx_10_16_x86_64.whl.

File metadata

File hashes

Hashes for psygnal-0.7.1-cp37-cp37m-macosx_10_16_x86_64.whl
Algorithm Hash digest
SHA256 d3ac88122fbc759e2dda0399872432b687fb54811e3db6b3ebad65d6169c9861
MD5 5b23f1f4c748853c38165e6f75f43956
BLAKE2b-256 96d624ebdcedb5435a30dd8275507ff412ce1ec33e82ddba9b62a233e5d55359

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page