Skip to main content

Package name: maslosoft_signals

Introduction

The package is port of PHP package Maslosoft Signals to Python.

Instead of using custom, vintage annotations processor, the package uses standard Python decorators.

Installation

pip install maslosoft-signals

Usage

from maslosoft.signals import Signal, SignalFor, SlotFor

@SlotFor("my_app.signals.UserRegistered")
class SendWelcomeEmail:
    def __init__(self, signal):
        signal.sent = True

@SignalFor("my_app.slots.GatherSlot")
class GatherableModel:
    pass

signals = Signal(paths=["src"])
signals.build()

# Emit a signal to all matching slots.
result = signals.emit(signal)

# Gather signal classes for a slot.
result = signals.gather(slot)

Current scope

The initial Python port supports:

  • SignalFor on classes
  • SlotFor on classes for constructor injection
  • SlotFor on methods for method injection
  • AST scanning of Python source files
  • generation of signals_definition.py
  • runtime loading through Signal.build(), Signal.emit(), and Signal.gather()

This first slice does not port PHP-style property injection.

Metadata

Release files for maslosoft-signals 0.1.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 maslosoft-signals 0.1.0
File Size Uploaded
maslosoft_signals-0.1.0.tar.gz 9.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for maslosoft-signals 0.1.0
File Interpreter ABI Platform
maslosoft_signals-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.8 kB

Release files / maslosoft_signals-0.1.0.tar.gz

Download URL maslosoft_signals-0.1.0.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
478bbaeaa8273b4b6539f3338f1d347dbc40bdc3a0f9b550e1098e86c2998910
BLAKE2b-256 checksum
How to use checksums
a99a5df15e86547ea39568ea9ef47a7adb27cef5a4c99044187f09c8133fcf62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / maslosoft_signals-0.1.0-py3-none-any.whl

Download URL maslosoft_signals-0.1.0-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ebaa3f27216445d1f7e5a3dbc4c9fe432d6bc8d9ef37eca78c840cbc104d9dad
BLAKE2b-256 checksum
How to use checksums
45fdf331b484af3bfb5fd046b62c10d6109a2377a750e844def3ac721e43ac84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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