Skip to main content

Python Wires: Simple Callable Wiring

PyPI CI Status Test Coverage Documentation

Python Wires is a library to facilitate callable wiring by decoupling callers from callees. It can be used as a simple callable-based event notification system, as an in-process publish-subscribe like solution, or in any context where 1:N callable decoupling is appropriate.

Installation

Python Wires is a pure Python package distributed via PyPI. Install it with:

$ pip install wires

Quick Start

Create a Wires object:

from wires import Wires

w = Wires()

Its attributes are callables, auto-created on first access, that can be wired to other callables:

def say_hello():
    print('Hello from wires!')

w.my_callable.wire(say_hello)       # Wires `w.my_callable`, auto-created, to `say_hello`.

Calling such callables calls their wired callables:

w.my_callable()                     # Prints 'Hello from wires!'

More wirings can be added:

def say_welcome():
    print('Welcome!')

w.my_callable.wire(say_welcome)     # Wires `w.my_callable` to `say_welcome`, as well.
w.my_callable()                     # Prints 'Hello from wires!' and 'Welcome!'.

Wirings can also be removed:

w.my_callable.unwire(say_hello)     # Removes the wiring to `say_hello`.
w.my_callable()                     # Prints 'Welcome!'

w.my_callable.unwire(say_welcome)   # Removes the wiring to `say_welcome`.
w.my_callable()                     # Does nothing.

To learn more about Python Wires, including passing parameters, setting wiring limits and tuning the call-time coupling behaviour, please refer to the remaining documentation at https://python-wires.readthedocs.org/.

Thanks

About

Python Wires was created by Tiago Montes.

Metadata

Release files for wires 19.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 wires 19.2.0
File Size Uploaded Provenance Actions
wires-19.2.0.tar.gz 21.1 kB Without provenance Details for wires-19.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wires 19.2.0
File Interpreter ABI Platform Actions
wires-19.2.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for wires-19.2.0-py2.py3-none-any.whl

Total release size: 31.4 kB

Release files / wires-19.2.0.tar.gz

Download URL wires-19.2.0.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7a59c8fbca9190b801bed6f24ff10e3e187decedc554ac6632487df5c7803bc8
BLAKE2b-256 checksum
How to use checksums
85574d0f749b92a6d5fac2ea7b31d203c6b336a5359a38e52ba676cb6ee4f7e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.2

Release files / wires-19.2.0-py2.py3-none-any.whl

Download URL wires-19.2.0-py2.py3-none-any.whl
Size 10.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
824304ff866cd7b8d336c83de31c2f1ab117af0a0f0951e98a29740854ab517c
BLAKE2b-256 checksum
How to use checksums
463a054cae776f06175d6c7ebdd1c40f7fe297dc720a826f865522945d71fe8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.2

Security for wires 19.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