Skip to main content

telnoti

Send Telegram notifications from Python scripts and notebooks. Zero dependencies beyond requests.

Installation

pip install telnoti

One-time Setup

Interactive (Python):

import telnoti as tn
tn.setup()

CLI:

telnoti setup

Both prompt for your bot token (from @BotFather) and chat ID, then save to ~/.config/.telnoti.config.

Usage

Basic

import telnoti as tn

tn.init()          # load saved config
tn.send("hello")
tn.done("training complete")

try:
    1 / 0
except Exception as e:
    tn.error(e)    # sends ❌ ZeroDivisionError: ... with traceback

Training Loop with Status Updates

import telnoti as tn

tn.init()

def status():
    tn.send(f"Epoch {current_epoch}/{total_epochs}, loss={loss:.4f}")

tn.start_status(status, every_n_seconds=300)  # every 5 minutes

for epoch in range(total_epochs):
    # ... training ...
    pass

tn.stop_status()
tn.done("Training finished!")

Decorator

import telnoti as tn

tn.init()

@tn.notify(start=True, end=True, error=True)
def run_experiment():
    # ... long-running code ...
    pass

run_experiment()
# sends: ▶️ run_experiment started
# sends: ✅ run_experiment finished  (or ❌ ... on error)

Jupyter Notebook

import telnoti as tn
tn.init()

# In a cell you want to be notified when complete:
# ... heavy computation ...
tn.done("Cell finished")

Send Images

tn.send_image("plot.png", caption="Loss curve")

Catch All Unhandled Exceptions

import telnoti as tn
tn.init()
tn.catch_all()  # any uncaught exception will be sent to Telegram

Bot Commands

Send /list to your bot to see all active and recently completed runs:

Active runs
  • train.py · PID 12345 · 14:32 (running 1h 23m, 42 msgs — "Epoch 8/10")

Last 24h
  ✅ data_prep.py · PID 10022 · 09:15 (2h 41m)
  ❌ train_v2.py · PID 11500 · 11:00 (45m)
  💀 overnight.py · PID 8800 · 02:00 (7h 12m)

The polling thread starts automatically on tn.init(). Active runs are always shown; completed/errored runs appear for 24 hours. Dead runs (process killed, last seen > 5 min ago) are shown with 💀.

Version

import telnoti
print(telnoti.__version__)  # e.g. 0.2.0
telnoti --version  # telnoti 0.2.0
telnoti -V

API

Function Description
init(token=None, chat_id=None, run_name=None) Initialize (loads config if no args); run_name overrides auto-detected name
setup() Interactive config wizard
send(text) Send a message
done(text) Send ✅ message
error(e, tb=True) Send ❌ error with optional traceback
send_image(path, caption=None) Send an image file
start_status(func, every_n_seconds=60) Schedule periodic status messages
stop_status() Cancel the status timer
notify(start, end, error) Decorator for notifications
catch_all() Hook sys.excepthook to send all unhandled errors
disable() Suppress all notifications (no messages sent)
enable() Re-enable notifications

Metadata

Release files for telnoti 0.2.1

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

Source distribution (sdist)

Source distribution for telnoti 0.2.1
File Size Uploaded Provenance Actions
telnoti-0.2.1.tar.gz 11.4 kB With provenance Details for telnoti-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for telnoti 0.2.1
File Interpreter ABI Platform Actions
telnoti-0.2.1-py3-none-any.whl Python 3 none any Details for telnoti-0.2.1-py3-none-any.whl

Total release size: 20.4 kB

Release files / telnoti-0.2.1.tar.gz

Download URL telnoti-0.2.1.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c44253edb39e0ff057fb4347bf409fa9adbccdad9b52ec6a418fd84f59eef072
BLAKE2b-256 checksum
How to use checksums
4982df8c20be81149808755d03c164f49bbb6fc03a7d68606f270a6a516d48fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 12, 2026.

Transparency log

Release files / telnoti-0.2.1-py3-none-any.whl

Download URL telnoti-0.2.1-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6cc08f22528060648caee6c6c4f3dc4e9b30c1e34033c9370acc42f86977258e
BLAKE2b-256 checksum
How to use checksums
851ccba24d73bf6b0c11e9df6cde320e2b2e3ad6fd1288c59fc0e29da9e19223
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 12, 2026.

Transparency log

Security for telnoti 0.2.1

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for telnoti-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 12, 2026.

Transparency log

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

0.2.1 This release

2 release files Full 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