Skip to main content

ix-notifiers

A python library for sending one notification to several services at once.

Install

pip install ix-notifiers

Usage

Build a core, register the notifiers you want, then send. notify() returns True when at least one channel accepted the notification.

from ix_notifiers import IxNotifiers

notifiers = IxNotifiers()

# Each keyword is prefixed with the name of the notifier it belongs to. The prefix is
# stripped before the notifier sees it, so `gotify_token` arrives as `token`.
notifiers.register(
    "gotify",
    gotify_url="https://gotify.example.com",
    gotify_token="your-application-token",
    gotify_default_priority=5,
)
notifiers.register("null")

notifiers.notify(title="Deploy", message="finished")

Every core holds its own registry, so two cores in one process do not see each other's notifiers. Registering a name no notifier answers to logs a warning and registers nothing.

Notifiers

Discovery is by filename: every *_notifier.py in the package is available under the name in front of _notifier.

gotify

Posts to a Gotify server's /message endpoint.

Parameter Mandatory Default Description
gotify_url yes - base URL of the Gotify server
gotify_token yes - application token, kept out of the logs
gotify_content_type no text/markdown content type of the message body
gotify_default_priority no 0 priority for messages that carry none

send() accepts title, message, priority and content_type. A field that is not given is left out of the request, and content_type overrides the default for that one message. A priority that will not convert to an integer is logged and the message is sent without one.

null

Logs the notification at info level and reports success. Useful for a dry run.

Writing a notifier

Add a <name>_notifier.py to the package with a Notifier subclass, a params declaration and a module-level start:

from typing import Any, ClassVar

from .notifier import Notifier


class WebhookNotifier(Notifier):
    """Posts a notification to a webhook."""

    params: ClassVar[dict[str, dict[str, Any]]] = {
        "url": {"mandatory": True, "type": "string"},
        "secret": {"mandatory": True, "redact": True, "type": "string"},
        "timeout": {"default": 10, "type": "integer"},
    }

    def send(self, **kwargs: Any) -> bool:
        """Sends the notification and reports whether it was accepted."""
        ...


start = WebhookNotifier.start

Each parameter declares a type of boolean, integer or string, and optionally mandatory, default and redact. The base class resolves them into self.settings:

  • a mandatory parameter has to be present, and a supplied 0, False or "" counts as present
  • an optional parameter falls back to its default, or to None where it declares none
  • a value of the wrong declared type is rejected, and an integer parameter rejects a boolean
  • a parameter marked redact has its value masked out of anything the notifier logs through self.redact()

Logging

Every module logs to the ix-notifiers logger and attaches no handler of its own, so the application decides where the records go.

Contributing

See CONTRIBUTING.md. Every change has to pass ruff check, ruff format --check, pylint and the test suite at 100% statement and branch coverage.

Metadata

Release files for ix-notifiers 2.0.27

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

Source distribution (sdist)

Source distribution for ix-notifiers 2.0.27
File Size Uploaded Provenance Actions
ix_notifiers-2.0.27.tar.gz 11.5 kB Without provenance Details for ix_notifiers-2.0.27.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ix-notifiers 2.0.27
File Interpreter ABI Platform Actions
ix_notifiers-2.0.27-py3-none-any.whl Python 3 none any Details for ix_notifiers-2.0.27-py3-none-any.whl

Total release size: 22.8 kB

Release files / ix_notifiers-2.0.27.tar.gz

Download URL ix_notifiers-2.0.27.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
17aa966b125c0c12f3a6d33c4c1a04b31450e25e966d24709c771d5830b23d29
BLAKE2b-256 checksum
How to use checksums
0ae86f5753a8b0dd6e1a3cb6d0854bc3460dc5dd2a9e1c4e79874f1f43fd5af2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.3 CPython/3.14.8 Linux/7.0.0-38-generic

Release files / ix_notifiers-2.0.27-py3-none-any.whl

Download URL ix_notifiers-2.0.27-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8741298e61e2d38bcf895fc4d8e8053f153eb1439487b3fd8ec2b23cd4e8a4c4
BLAKE2b-256 checksum
How to use checksums
415a47d5c0d2ef444bea595d7e832ae3b670798858ad76cbae3be0d87e1caeea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.3 CPython/3.14.8 Linux/7.0.0-38-generic

Security for ix-notifiers 2.0.27

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.

Release history Release notifications | RSS feed

This release

2.0.27 This release

2 release files No provenance

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