Skip to main content

Smart Signals

Build codecov PyPi version License: MIT

This is a small lib for the signal-slot-pattern. This corresponds to a modification of the observer pattern. It originally comes from QT.

The input types are checked to ensure that they also correspond to the definition. The default python data types (str, int, float, list) and also the typing data types (List[str], Dict[str, int]) are supported. In addition, the log can be used to track which signal called which slot for error diagnosis.

Install

You can install this package with pip tool from https://pypi.org/.

pip install SmartSignals

Usage

import logging

from smart_signals import SmartSignal, SmartSignalSlot

logging.basicConfig(level=logging.DEBUG, format="%(asctime)s | %(levelname)-10.10s | %(name)-30.30s | %(message)s")


class Test:
    @SmartSignalSlot(str)
    def slot(self, message: str):
        print(message)
        pass


test = Test()
signal = SmartSignal(str)
signal.connect(test.slot)
signal.emit("message")

Log output

2022-06-07 21:16:52 | DEBUG      | SmartSignal                    | emit signal from: .\PySignals\smart_signals_tests\test_smart_signals.py:test_py_signal_check_emit_type_string:145 to slot <function TestPySignal.test_py_signal_check_emit_type_string.<locals>.signal_slot_with_typ_list_of_string at 0x000001B9259A6F70>

Metadata

Release files for SmartSignals 0.2.0

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

Source distribution (sdist)

Source distribution for SmartSignals 0.2.0
File Size Uploaded Provenance Actions
SmartSignals-0.2.0.tar.gz 5.0 kB Without provenance Details for SmartSignals-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for SmartSignals 0.2.0
File Interpreter ABI Platform Actions
SmartSignals-0.2.0-py3-none-any.whl Python 3 none any Details for SmartSignals-0.2.0-py3-none-any.whl

Total release size: 10.1 kB

Release files / SmartSignals-0.2.0.tar.gz

Download URL SmartSignals-0.2.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f179776e2cfd86882933fa0f9bf5967aad4af7cb7cab862265f86b02e3eb96c7
BLAKE2b-256 checksum
How to use checksums
57b4d538b682ecaa7833c6e4044cf911607c7eaba0ddaf93a45cc104bed020f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / SmartSignals-0.2.0-py3-none-any.whl

Download URL SmartSignals-0.2.0-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52f32d14a081ba0780feffc3dfbc0c0fb76013e1d6ec067109a8c666b229c6e5
BLAKE2b-256 checksum
How to use checksums
9d4e3150cb183a3a14c9a69af626f91ee8117553330be2b6102cfbe466cc94c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Security for SmartSignals 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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