{"id":16039750,"url":"https://github.com/hpprc/deadbeats","last_synced_at":"2025-03-18T04:30:46.429Z","repository":{"id":52120234,"uuid":"308366193","full_name":"hppRC/deadbeats","owner":"hppRC","description":"☠️ Easy to use slack messaging library ☠️","archived":false,"fork":false,"pushed_at":"2021-05-07T07:08:34.000Z","size":210,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-28T06:58:19.026Z","etag":null,"topics":["heartbeat","python","research","slack"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/deadbeats/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hppRC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-29T15:12:31.000Z","updated_at":"2023-08-05T09:55:03.000Z","dependencies_parsed_at":"2022-09-03T09:50:28.289Z","dependency_job_id":null,"html_url":"https://github.com/hppRC/deadbeats","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hppRC%2Fdeadbeats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hppRC%2Fdeadbeats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hppRC%2Fdeadbeats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hppRC%2Fdeadbeats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hppRC","download_url":"https://codeload.github.com/hppRC/deadbeats/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243902293,"owners_count":20366258,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["heartbeat","python","research","slack"],"created_at":"2024-10-08T23:07:28.558Z","updated_at":"2025-03-18T04:30:45.891Z","avatar_url":"https://github.com/hppRC.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DEADBEATS\n\nAn easy to use Slack messaging library for research.\n\n## Usage\n\n```python\nfrom deadbeats import DEADBEATS\n# set environment variables as below\n# SLACK_ACCESS_TOKEN=xxxx-xxxxxxxxxxxxx-xxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx (Get your own Slack API access token)\n# SLACK_CHANNEL_ID=deadbeats (set slack channel id whatever you like!)\n\n\n# or you can set configurations manually.\nDEADBEATS.set_access_token(\"SLACK_ACCESS_TOKEN\")\nDEADBEATS.set_channel_id(\"SLACK_CHANNEL_ID\")\n\n\n# `DEADBEATS.wrap` sends a message at the beginning and the end of the wrapped function.\n# `DEADBEATS.wrap` catch every errors and raise it after sending a error message.\n@DEADBEATS.wrap\ndef main():\n    # A simple \"heartbeating\" message.\n    DEADBEATS.ping()\n\n\n    # Start threading!\n    # All subsequent messages will be sent to the thread.\n    DEADBEATS.start_thread()\n\n\n    # You can add extra information like below.\n    params = {\"loss\": 0.5, \"val_loss\": 1.6, \"acc\": 100.0}\n    DEADBEATS.ping(text=\"message whatever you like\", params=params, additional=\"info\", huga=\"huga\")\n\n\n    # If you want to stop threading, you can use this method.\n    # This method reset \"thread_ts\" of a instance variable, which is a id of thread.\n    DEADBEATS.reset_thread()\n```\n\n## With PyTorch Lightning\n\n```python\nfrom deadbeats import DEADBEATS\n\nclass MyModel(pl.LightningModule):\n\n    ...\n\n    def on_train_start(self):\n        DEADBEATS.start_thread()\n\n    ...\n\n    def validation_epoch_end(self, outputs):\n        avg_loss = torch.stack([x['val_loss'] for x in outputs]).mean()\n\n        DEADBEATS.ping(val_loss = avg_loss, current_epoch = self.current_epoch)\n\n        return {'val_loss': avg_loss}\n\n    ...\n\n    # custom training function\n    @DEADBEATS.wrap\n    def fit(self, trainer):\n        trainer.fit(self)\n\n```\n\n\n## messages like below\n\n![example](.github/images/example_message.png)\n\n\n\nThis library is named after the wonderful work of [Mori Calliope](https://www.youtube.com/channel/UCL_qhgtOy0dy1Agp8vkySQg), [DEAD BEATS](https://youtu.be/6ydgEipkUEU), and inspired by [hugginface/knockknock](https://github.com/huggingface/knockknock).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhpprc%2Fdeadbeats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhpprc%2Fdeadbeats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhpprc%2Fdeadbeats/lists"}