Skip to main content

telebot-py

Async-first Telegram Bot Framework for Python, mirroring python-telegram-bot's public API.

PyPI version Python CI

telebot-py is the third language implementation of this repository's Telegram bot framework, alongside telebot-ts (TypeScript) and telebot-go (Go). It is built from scratch in native Python (asyncio-first) and mirrors the python-telegram-bot API in native snake_case, including native & / | / ~ filter operators.

Features

  • Bot client over httpx (the single required runtime dependency) with retry semantics (429/5xx exponential backoff, retry_after honored) and a pluggable transport for offline testing.
  • Application kernel: builder, dispatcher with ordered handler groups, long polling and webhook modes, full lifecycle management.
  • Handlers: command, message, callback query, conversation (standard/linear/async forms), and the extended handler set.
  • Composable filters with native Python operators.
  • Scheduler: JobQueue with one-shot, repeating, and RRule schedules.
  • Persistence: memory, JSON file, and SQLite backends behind one contract.
  • Plugins with hooks, ordering, and built-in i18n; components for menus and keyboards.

Installation

Requires Python 3.10+. telebot-py is versioned in lockstep with telebot-ts and telebot-go (currently 1.4.0). Install from PyPI:

pip install telebot-py

Or from source:

pip install packages/python          # from the repo root

Quick Start

from telebot_py import ApplicationBuilder, CallbackContext, CommandHandler, MessageHandler, filters
from telebot_py.types import Update


async def start(update: Update, context: CallbackContext) -> None:
    await context.bot.send_message(chat_id=update.effective_chat.id, text="Hello!")


async def echo(update: Update, context: CallbackContext) -> None:
    await context.bot.send_message(
        chat_id=update.effective_chat.id, text=update.effective_message.text
    )


app = ApplicationBuilder().token("YOUR_BOT_TOKEN").build()
app.add_handler(CommandHandler("start", start))
app.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, echo))
app.run_polling()

Documentation

Full API reference (kernel, bot, routing, filters, scheduler, storage, plugins, components, types) lives in docs/ and is generated with Sphinx from the in-source docstrings. The published site is served by GitHub Pages at https://nam088.github.io/telebot/python/ (see the combined docs site).

Build the docs locally (requires the [dev] extra):

cd packages/python
source .venv/bin/activate
sphinx-build -W --keep-going docs docs/_build
open docs/_build/index.html   # macOS

-W --keep-going treats warnings as errors, matching CI. docs/_build/ is gitignored and never committed.

Development

cd packages/python
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

ruff check src tests scripts && ruff format --check src tests scripts
mypy --strict src
pytest --cov=telebot_py --cov-fail-under=80
python scripts/parity_audit.py   # node/go/python API parity (CI-enforced)

Tests that need a live bot are marked @pytest.mark.live and auto-skip unless TEST_BOT_TOKEN is set. The default suite runs fully offline.

Releasing

Releases are automated: pushing a tag of the form packages/python/vX.Y.Z triggers python-release.yml, which builds the package, generates changelog notes from conventional commits via git-cliff (scoped to packages/python/* in cliff.toml), creates a GitHub Release, and publishes to PyPI using trusted publishing (OIDC — no stored API tokens).

To cut a release locally and verify it before tagging:

cd packages/python
source .venv/bin/activate

python -m build            # produces dist/telebot_py-X.Y.Z.tar.gz + .whl
twine check dist/*         # validates metadata/README rendering
sphinx-build -W --keep-going docs docs/_build   # docs gate

git tag packages/python/vX.Y.Z
git push origin packages/python/vX.Y.Z

Pre-release checklist (manual steps, not automatable offline):

  1. Confirm the PyPI name is still available: pip index versions telebot-py or browse https://pypi.org/project/telebot-py/. If squatted, the fallback name is telebot-python (update pyproject.toml [project].name and the workflow packages-dir accordingly).
  2. Bump version in pyproject.toml — docs/conf.py and the build backend both read it from there.
  3. Ensure CI (ci.yml) and the parity audit are green on the commit to tag.

License

MIT — see LICENSE.

Metadata

Release files for telebot-py 1.6.0

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

Source distribution (sdist)

Source distribution for telebot-py 1.6.0
File Size Uploaded
telebot_py-1.6.0.tar.gz 282.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for telebot-py 1.6.0
File Interpreter ABI Platform
telebot_py-1.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 542.8 kB

Release files / telebot_py-1.6.0.tar.gz

Download URL telebot_py-1.6.0.tar.gz
Size 282.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7995e362ac3ec4bb79022605bef819d031d21ebf436754495ef39d94956fa87d
BLAKE2b-256 checksum
How to use checksums
fd7c79aab8fca4fcba5ca47193a513766932c9b23bdedfec7834cb1ae20f57a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 31, 2026.

Transparency log

Release files / telebot_py-1.6.0-py3-none-any.whl

Download URL telebot_py-1.6.0-py3-none-any.whl
Size 260.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
95e02310bd7951fd4df9c6f3d32edf601768b11e3800b4ff9591d395ee34966b
BLAKE2b-256 checksum
How to use checksums
862f16bc77d826e2d9b546ea25f5688405a3af17823e80eada87f7266efcbe9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 31, 2026.

Transparency log

Release history Release notifications | RSS feed

1.8.0

2 release files

1.7.0

2 release files

This release

1.6.0 This release

2 release files

1.5.0

2 release files

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