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.8.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.8.0
File Size Uploaded
telebot_py-1.8.0.tar.gz 282.5 kB Details

Built distribution (wheel)

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

Total release size: 543.7 kB

Release files / telebot_py-1.8.0.tar.gz

Download URL telebot_py-1.8.0.tar.gz
Size 282.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3c0b74517612a47c4615551112a42084a64847644a4163e47e3561bf2e4e5549
BLAKE2b-256 checksum
How to use checksums
d2075d1b803688735d74d50444dce45cb3b3aee0c35b12f4087312d13cf80ff5
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 Sep 1, 2026.

Transparency log

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

Download URL telebot_py-1.8.0-py3-none-any.whl
Size 261.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0eea4d985e668ef9c181088be87472298f3d56ee22c3569b1321ac11ed1e696
BLAKE2b-256 checksum
How to use checksums
fc9003acd94e783df9b165b3a75298bfb7400cf28063a2de3f80f49f3eac3259
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 Sep 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.8.0 This release

2 release files

1.7.0

2 release files

1.6.0

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