Skip to main content

The spiritual successor to knockknock for PyTorch Lightning, get notified when your training ends

Project description

Who's there?

Build Documentation GitHub Release PyPI - Package Version PyPI - Python Version Dependencies Status Conda - Platform Conda (channel only) Docs with MkDocs Poetry linting: ruff pre-commit Checked with pyright security: bandit Semantic Versions Copier License

The spiritual successor to knockknock for PyTorch Lightning, to get a notification when your training is complete or when it crashes during the process with a single callback.

Features

  • Supports E-Mail, Discord, Slack, Teams, Telegram

Installation

With pip:

python -m pip install whos-there

With poetry:

poetry add whos-there

With conda:

conda install conda-forge::whos-there

Check here for more information.

How to use it

import lightning.pytorch as pl
from whos_there.callback import NotificationCallback
from whos_there.senders.debug import DebugSender

trainer = pl.Trainer(
    callbacks=[
        NotificationCallback(senders=[
            # Add your senders here
            DebugSender(),
        ])
    ]
)

E-Mail

Requires your e-mail provider specific SMTP settings.

from whos_there.senders.email import EmailSender
# ...
EmailSender(
    host="smtp.example.de",
    port=587,
    sender_email="from@example.com",
    password="*********",
    recipient_emails=[
        "to1@example.com",
        "to2@example.com",
    ]
)

Discord

Requires your Discord channel's webhook URL.

from whos_there.senders.discord import DiscordSender
# ...
DiscordSender(
    webhook_url="https://discord.com/api/webhooks/XXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
)

Slack

Requires your Slack room webhook URL and optionally your user id (if you want to tag yourself or someone else).

from whos_there.senders.slack import SlackSender
# ...
SlackSender(
    webhook_url="https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX",   # gitleaks:allow
    channel="channel_name",
    user_mentions=[
        "XXXXXXXX"
    ]
)

Teams

Requires your Team Channel webhook URL.

from whos_there.senders.teams import TeamsSender
# ...
TeamsSender(
    webhook_url="https://XXXXX.webhook.office.com/",
    user_mentions=[
        "twsl"
    ]
)

Telegram

You can also use Telegram Messenger to get notifications. You'll first have to create your own notification bot by following the three steps provided by Telegram here and save your API access TOKEN. Telegram bots are shy and can't send the first message so you'll have to do the first step. By sending the first message, you'll be able to get the chat_id required (identification of your messaging room) by visiting https://api.telegram.org/bot<YourBOTToken>/getUpdates and get the int under the key message['chat']['id'].

from whos_there.senders.telegram import TelegramSender
# ...
TelegramSender(
    chat_id=1234567890,
    token="XXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXX"
)

Docs

poetry run mkdocs build -f ./docs/mkdocs.yaml -d ./_build/

Update template

copier update --trust

Credits

This project was generated with 🚀 A generic python project template.

Big thanks to knockknock for the idea and code snippets.

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

whos_there-0.4.0.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

whos_there-0.4.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file whos_there-0.4.0.tar.gz.

File metadata

  • Download URL: whos_there-0.4.0.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1025-azure

File hashes

Hashes for whos_there-0.4.0.tar.gz
Algorithm Hash digest
SHA256 d00a0ef5450ffbf4aa5cce9c02bd7510963445b7915db2d67be092db80f2b615
MD5 20a8e0c17d9fd4b9ac98aa2d610ce9e6
BLAKE2b-256 e4f3c2cc5c8435c3dbeadf7fb969e9a7a2ed36ff45a1706b287b5c01983f5a81

See more details on using hashes here.

File details

Details for the file whos_there-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: whos_there-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1025-azure

File hashes

Hashes for whos_there-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a98c6234a1dcf6b8143abc1dc361e96e2cd1f9f9878f8f320e2de4aac53a953
MD5 923860d13bd4a504d448d955defee2cc
BLAKE2b-256 6dee5b59e9bc24d835c1e78a5f5a617c0b1dcd5ef255bc3e5b0195bd2574d31e

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