wizardgram
Async Telegram bot framework for Python.
Works with Python 3.10+. Tracks the current Bot API and documents what's verified.
Installation · Quickstart · Features · Examples · Docs · Contributing
Installation
pip install wizardgram
Quickstart
import wizardgram
bot = wizardgram.Bot(token="YOUR_BOT_TOKEN")
@bot.command("start")
async def start(ctx: wizardgram.Context) -> None:
await ctx.reply("Hello!")
if __name__ == "__main__":
bot.run()
Set WIZARDGRAM_TOKEN before running your bot.
Features
Middleware
async def logging_middleware(ctx, next_):
print(ctx.update_type)
await next_()
bot.use(logging_middleware)
Bot API Coverage
from wizardgram import status
print(status("sendMessage").value)
FSM
from wizardgram import Scene, Stage
stage = Stage([Scene("signup", [collect_name, collect_city])])
bot.use(stage.middleware())
Keyboards
from wizardgram import Keyboard
keyboard = Keyboard.inline().button("Confirm", callback_data="confirm").build()
Webhooks
async def telegram_webhook(request):
return await bot.handle_webhook(request)
File Uploads
@bot.command("photo")
async def photo(ctx):
await ctx.reply_with_photo("photo.jpg", caption="Attached")
Examples
| File | Description | Run |
|---|---|---|
echo_bot.py |
Echoes incoming text. | WIZARDGRAM_TOKEN=... python examples/echo_bot.py |
menu_bot.py |
Inline Confirm/Cancel keyboard. | WIZARDGRAM_TOKEN=... python examples/menu_bot.py |
scene_bot.py |
Two-step signup scene. | WIZARDGRAM_TOKEN=... python examples/scene_bot.py |
middleware_bot.py |
Logging and rate limiting. | WIZARDGRAM_TOKEN=... python examples/middleware_bot.py |
webhook_bot.py |
FastAPI webhook endpoint. | uvicorn examples.webhook_bot:app |
Coverage Confidence
| Area | Confidence | How it was verified |
|---|---|---|
| Core send methods | Verified | Included in the bundled method status table. |
| Update polling | Verified | Included in the bundled method status table. |
| Webhook methods | Verified | Included in the bundled method status table. |
| Callback queries | Verified | Included in the bundled method status table. |
| Chat administration | Verified | Included in the bundled method status table. |
| Multipart uploads | Inferred | Exercised with mocked HTTP requests. |
Project Layout
src/wizardgram/
bot.py
context.py
coverage.py
errors.py
fsm.py
keyboard.py
middleware.py
router.py
testing.py
transport.py
types.py
examples/
echo_bot.py
menu_bot.py
middleware_bot.py
scene_bot.py
webhook_bot.py
Star History
Contributing
See CONTRIBUTING.md for development setup and pull request guidance.
License
Apache-2.0. See LICENSE.
Metadata
Release files for wizardgram 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wizardgram-0.1.0.tar.gz | 22.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wizardgram-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.6 kB
Release files / wizardgram-0.1.0.tar.gz
| Download URL | wizardgram-0.1.0.tar.gz |
|---|---|
| Size | 22.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57473c7f13f36ea16894c086d27184678af26b6db58bcc6395e1dab69198fb61
|
|
BLAKE2b-256 checksum How to use checksums |
07670bad7ec5f2cdd0af54f5f401f3d205a5347cda2b36889c145d02817f6765
|
| 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 Oct 1, 2026.
Transparency logRelease files / wizardgram-0.1.0-py3-none-any.whl
| Download URL | wizardgram-0.1.0-py3-none-any.whl |
|---|---|
| Size | 21.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2f19c8eae4c0b065dddd82ea31908243d527d61b9678a34d27f547c35f91c9a2
|
|
BLAKE2b-256 checksum How to use checksums |
24be8b5cf761d0ca0c53405e468d2b0de3e6c48109f33ae968f83067df8172bd
|
| 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 Oct 1, 2026.
Transparency log