# Who's there?
[![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)
[![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)
[![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-border.json)](https://github.com/copier-org/copier)
[![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
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.
## 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/
```
## Update template
```bash
copier update --trust
```
## 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/e4/f3/c2cc5c8435c3dbeadf7fb969e9a7a2ed36ff45a1706b287b5c01983f5a81/whos_there-0.4.0.tar.gz",
"platform": null,
"description": "# Who's there?\n\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[![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[![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-border.json)](https://github.com/copier-org/copier)\n[![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)\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## 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## Update template\n\n```bash\ncopier update --trust\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.4.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": "6dee5b59e9bc24d835c1e78a5f5a617c0b1dcd5ef255bc3e5b0195bd2574d31e",
"md5": "923860d13bd4a504d448d955defee2cc",
"sha256": "7a98c6234a1dcf6b8143abc1dc361e96e2cd1f9f9878f8f320e2de4aac53a953"
},
"downloads": -1,
"filename": "whos_there-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "923860d13bd4a504d448d955defee2cc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 11554,
"upload_time": "2024-09-07T11:23:15",
"upload_time_iso_8601": "2024-09-07T11:23:15.883398Z",
"url": "https://files.pythonhosted.org/packages/6d/ee/5b59e9bc24d835c1e78a5f5a617c0b1dcd5ef255bc3e5b0195bd2574d31e/whos_there-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e4f3c2cc5c8435c3dbeadf7fb969e9a7a2ed36ff45a1706b287b5c01983f5a81",
"md5": "20a8e0c17d9fd4b9ac98aa2d610ce9e6",
"sha256": "d00a0ef5450ffbf4aa5cce9c02bd7510963445b7915db2d67be092db80f2b615"
},
"downloads": -1,
"filename": "whos_there-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "20a8e0c17d9fd4b9ac98aa2d610ce9e6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 11112,
"upload_time": "2024-09-07T11:23:17",
"upload_time_iso_8601": "2024-09-07T11:23:17.198733Z",
"url": "https://files.pythonhosted.org/packages/e4/f3/c2cc5c8435c3dbeadf7fb969e9a7a2ed36ff45a1706b287b5c01983f5a81/whos_there-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-07 11:23:17",
"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"
}