# Who's there?
<!--- BADGES: START --->
[![Build](https://github.com/twsl/whos-there/actions/workflows/build.yaml/badge.svg)](https://github.com/twsl/whos-there/actions/workflows/build.yaml)
[![Documentation](https://github.com/twsl/whos-there/actions/workflows/docs.yaml/badge.svg)](https://github.com/twsl/whos-there/actions/workflows/docs.yaml)
![GitHub Release](https://img.shields.io/github/v/release/twsl/whos-there?include_prereleases)
[![PyPI - Package Version](https://img.shields.io/pypi/v/whos-there?logo=pypi&style=flat&color=orange)](https://pypi.org/project/whos-there/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/whos-there?logo=pypi&style=flat&color=blue)](https://pypi.org/project/whos-there/)
[![Dependencies Status](https://img.shields.io/badge/dependencies-up%20to%20date-brightgreen.svg)](https://github.com/twsl/whos-there/pulls?utf8=%E2%9C%93&q=is:pr%20author:app/dependabot)
[![Conda - Platform](https://img.shields.io/conda/pn/conda-forge/whos-there?logo=anaconda&style=flat)](https://anaconda.org/conda-forge/whos-there)
[![Conda (channel only)](https://img.shields.io/conda/vn/conda-forge/whos-there?logo=anaconda&style=flat&color=orange)](https://anaconda.org/conda-forge/whos-there)
[![Docs with MkDocs](https://img.shields.io/badge/MkDocs-docs?style=flat&logo=materialformkdocs&logoColor=white&color=%23526CFE)](https://squidfunk.github.io/mkdocs-material/)
[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
[![linting: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](.pre-commit-config.yaml)
[![Checked with pyright](https://microsoft.github.io/pyright/img/pyright_badge.svg)](https://microsoft.github.io/pyright/)
[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)
[![vulnerability: safety](https://img.shields.io/badge/vulnerability-safety-yellow.svg)](https://github.com/pyupio/safety)
[![Semantic Versions](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--versions-e10079.svg)](https://github.com/twsl/whos-there/releases)
[![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
<!--- BADGES: END --->
The spiritual successor to [knockknock](https://github.com/huggingface/knockknock) for [PyTorch Lightning](https://github.com/PyTorchLightning/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`:
```bash
python -m pip install whos-there
```
With [`poetry`](https://python-poetry.org/):
```bash
poetry add whos-there
```
With `conda`:
```bash
conda install conda-forge::whos-there
```
Check [here](https://github.com/conda-forge/whos-there-feedstock) for more information.
## Update template
```bash
copier update --trust
```
## How to use it
```python
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.
```python
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](https://support.discordapp.com/hc/en-us/articles/228383668-Intro-to-Webhooks).
```python
from whos_there.senders.discord import DiscordSender
# ...
DiscordSender(
webhook_url="https://discord.com/api/webhooks/XXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
)
```
### Slack
Requires your Slack room [webhook URL](https://api.slack.com/incoming-webhooks#create_a_webhook) and optionally your [user id](https://api.slack.com/methods/users.identity) (if you want to tag yourself or someone else).
```python
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](https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/connectors/connectors-using).
```python
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](https://core.telegram.org/bots#6-botfather) 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']`.
```python
from whos_there.senders.telegram import TelegramSender
# ...
TelegramSender(
chat_id=1234567890,
token="XXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXX"
)
```
## Docs
```bash
poetry run mkdocs build -f ./docs/mkdocs.yaml -d ./_build/
```
## Credits
This project was generated with [![🚀 A generic python project template.](https://img.shields.io/badge/python--project--template-%F0%9F%9A%80-brightgreen)](https://github.com/twsl/python-project-template)
Big thanks to [knockknock](https://github.com/huggingface/knockknock) for the idea and code snippets.
Raw data
{
"_id": null,
"home_page": "https://twsl.github.io/whos-there/",
"name": "whos-there",
"maintainer": "twsl",
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": "45483159+twsl@users.noreply.github.com",
"keywords": "python, pytorch, pytorch-lightning, machine-learning, deep-learning",
"author": "twsl",
"author_email": "45483159+twsl@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/37/37/e2aa00de34a7607145cc000aa27d91dc4bc5ff3baf652cc9d223cfba8c12/whos_there-0.2.0.tar.gz",
"platform": null,
"description": "# Who's there?\n\n<!--- BADGES: START --->\n[![Build](https://github.com/twsl/whos-there/actions/workflows/build.yaml/badge.svg)](https://github.com/twsl/whos-there/actions/workflows/build.yaml)\n[![Documentation](https://github.com/twsl/whos-there/actions/workflows/docs.yaml/badge.svg)](https://github.com/twsl/whos-there/actions/workflows/docs.yaml)\n![GitHub Release](https://img.shields.io/github/v/release/twsl/whos-there?include_prereleases)\n[![PyPI - Package Version](https://img.shields.io/pypi/v/whos-there?logo=pypi&style=flat&color=orange)](https://pypi.org/project/whos-there/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/whos-there?logo=pypi&style=flat&color=blue)](https://pypi.org/project/whos-there/)\n[![Dependencies Status](https://img.shields.io/badge/dependencies-up%20to%20date-brightgreen.svg)](https://github.com/twsl/whos-there/pulls?utf8=%E2%9C%93&q=is:pr%20author:app/dependabot)\n[![Conda - Platform](https://img.shields.io/conda/pn/conda-forge/whos-there?logo=anaconda&style=flat)](https://anaconda.org/conda-forge/whos-there)\n[![Conda (channel only)](https://img.shields.io/conda/vn/conda-forge/whos-there?logo=anaconda&style=flat&color=orange)](https://anaconda.org/conda-forge/whos-there)\n[![Docs with MkDocs](https://img.shields.io/badge/MkDocs-docs?style=flat&logo=materialformkdocs&logoColor=white&color=%23526CFE)](https://squidfunk.github.io/mkdocs-material/)\n[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)\n[![linting: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](.pre-commit-config.yaml)\n[![Checked with pyright](https://microsoft.github.io/pyright/img/pyright_badge.svg)](https://microsoft.github.io/pyright/)\n[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)\n[![vulnerability: safety](https://img.shields.io/badge/vulnerability-safety-yellow.svg)](https://github.com/pyupio/safety)\n[![Semantic Versions](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--versions-e10079.svg)](https://github.com/twsl/whos-there/releases)\n[![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)\n<!--- BADGES: END --->\n\nThe spiritual successor to [knockknock](https://github.com/huggingface/knockknock) for [PyTorch Lightning](https://github.com/PyTorchLightning/pytorch-lightning), to get a notification when your training is complete or when it crashes during the process with a single callback.\n\n\n## Features\n\n- Supports E-Mail, Discord, Slack, Teams, Telegram\n\n\n## Installation\n\nWith `pip`:\n```bash\npython -m pip install whos-there\n```\n\nWith [`poetry`](https://python-poetry.org/):\n```bash\npoetry add whos-there\n```\n\nWith `conda`:\n\n```bash\nconda install conda-forge::whos-there\n```\nCheck [here](https://github.com/conda-forge/whos-there-feedstock) for more information.\n\n\n## Update template\n\n```bash\ncopier update --trust\n```\n\n\n## How to use it\n\n```python\nimport lightning.pytorch as pl\nfrom whos_there.callback import NotificationCallback\nfrom whos_there.senders.debug import DebugSender\n\ntrainer = pl.Trainer(\n callbacks=[\n NotificationCallback(senders=[\n # Add your senders here\n DebugSender(),\n ])\n ]\n)\n```\n\n### E-Mail\nRequires your e-mail provider specific SMTP settings.\n\n```python\nfrom whos_there.senders.email import EmailSender\n# ...\nEmailSender(\n host=\"smtp.example.de\",\n port=587,\n sender_email=\"from@example.com\",\n password=\"*********\",\n recipient_emails=[\n \"to1@example.com\",\n \"to2@example.com\",\n ]\n)\n```\n\n### Discord\nRequires your Discord channel's [webhook URL](https://support.discordapp.com/hc/en-us/articles/228383668-Intro-to-Webhooks).\n\n```python\nfrom whos_there.senders.discord import DiscordSender\n# ...\nDiscordSender(\n webhook_url=\"https://discord.com/api/webhooks/XXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\"\n)\n```\n\n### Slack\nRequires your Slack room [webhook URL](https://api.slack.com/incoming-webhooks#create_a_webhook) and optionally your [user id](https://api.slack.com/methods/users.identity) (if you want to tag yourself or someone else).\n\n```python\nfrom whos_there.senders.slack import SlackSender\n# ...\nSlackSender(\n webhook_url=\"https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX\", # gitleaks:allow\n channel=\"channel_name\",\n user_mentions=[\n \"XXXXXXXX\"\n ]\n)\n```\n\n### Teams\nRequires your Team Channel [webhook URL](https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/connectors/connectors-using).\n\n```python\nfrom whos_there.senders.teams import TeamsSender\n# ...\nTeamsSender(\n webhook_url=\"https://XXXXX.webhook.office.com/\",\n user_mentions=[\n \"twsl\"\n ]\n)\n```\n\n### Telegram\nYou 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](https://core.telegram.org/bots#6-botfather) and save your API access `TOKEN`.\nTelegram 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']`.\n\n```python\nfrom whos_there.senders.telegram import TelegramSender\n# ...\nTelegramSender(\n chat_id=1234567890,\n token=\"XXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXX\"\n)\n```\n\n\n## Docs\n\n```bash\npoetry run mkdocs build -f ./docs/mkdocs.yaml -d ./_build/\n```\n\n\n## Credits\n\nThis project was generated with [![\ud83d\ude80 A generic python project template.](https://img.shields.io/badge/python--project--template-%F0%9F%9A%80-brightgreen)](https://github.com/twsl/python-project-template)\n\nBig thanks to [knockknock](https://github.com/huggingface/knockknock) for the idea and code snippets.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "The spiritual successor to knockknock for PyTorch Lightning, get notified when your training ends",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://twsl.github.io/whos-there/",
"Repository": "https://github.com/twsl/whos-there",
"issues": "https://github.com/twsl/whos-there/issues"
},
"split_keywords": [
"python",
" pytorch",
" pytorch-lightning",
" machine-learning",
" deep-learning"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a37ac3f20a76337f5cde12cb61f9412ef5ee2a6a8302d94a61dae258c97752d6",
"md5": "c56f79229763682db89867334a6e4206",
"sha256": "cdad0c0f64d6b929b06cb3889fe21c21a46bad4548cc42ab4b34448d34605b9e"
},
"downloads": -1,
"filename": "whos_there-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c56f79229763682db89867334a6e4206",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 11463,
"upload_time": "2024-04-22T11:51:00",
"upload_time_iso_8601": "2024-04-22T11:51:00.156068Z",
"url": "https://files.pythonhosted.org/packages/a3/7a/c3f20a76337f5cde12cb61f9412ef5ee2a6a8302d94a61dae258c97752d6/whos_there-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3737e2aa00de34a7607145cc000aa27d91dc4bc5ff3baf652cc9d223cfba8c12",
"md5": "6a1fe3ff849dcf4f3e93df21dfdd4e3a",
"sha256": "3118a80bd2308fc801836478bbb266374927cb4cddbde786eb8f134527c2ead9"
},
"downloads": -1,
"filename": "whos_there-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "6a1fe3ff849dcf4f3e93df21dfdd4e3a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 10965,
"upload_time": "2024-04-22T11:51:04",
"upload_time_iso_8601": "2024-04-22T11:51:04.210502Z",
"url": "https://files.pythonhosted.org/packages/37/37/e2aa00de34a7607145cc000aa27d91dc4bc5ff3baf652cc9d223cfba8c12/whos_there-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-22 11:51:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "twsl",
"github_project": "whos-there",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "whos-there"
}