A modern, elegant, asynchronous MTProto framework for building Telegram clients and bots in Python.
Project description
ferogram-py
A modern, elegant, asynchronous MTProto framework for building Telegram clients and bots in Python.
Powered by a high-performance Rust core that takes care of networking, encryption, TL parsing, and session management so you can focus on writing clean, idiomatic Python.
Why ferogram-py?
Most of the heavy lifting in an MTProto client happens behind the scenes; networking, encryption, TL parsing, and keeping up with updates. ferogram-py lets a Rust core handle all of that, while exposing a clean, Pythonic API.
For most applications, the high-level API is all you'll need. But if you want to use a brand-new Telegram feature or need something more advanced, you can always drop down to the raw MTProto API and invoke requests directly.
The goal is to stay out of your way: simple things should be simple, and advanced things should still be possible.
Quick API reference: FEATURES.md
Install
pip install ferogram
Building from source
make dev # editable install into .venv (builds the Rust extension)
make build # release wheel for this machine
make codegen # regenerate TL code without a Rust rebuild
make test # run tests
make clean # wipe .venv, target, dist, generated/
On Termux: pkg install rust clang python first.
Rust-only change, don't want to wait on codegen: FEROGRAM_SKIP_CODEGEN=1 maturin develop
Quick start
Bot:
from ferogram import Client, filters
app = Client("mybot", api_id=0, api_hash="", bot_token="123:TOKEN")
@app.on_message(filters.command("start"))
async def start(client, message):
await message.reply("Hello!")
app.run()
User:
import asyncio
from ferogram import Client
app = Client("myaccount", api_id=0, api_hash="", phone="+1234567890")
async def main():
async with app as client:
await client.send_message("me", "logged in")
asyncio.run(main())
Credentials also work from env vars: API_ID, API_HASH, BOT_TOKEN.
Logging
import ferogram.logging as fero_log
fero_log.setup() # INFO to stderr
fero_log.setup(level=10) # DEBUG
Architecture
The compiled extension (_ferogram.so) stays deliberately small: networking, encryption, session storage, and MTProto internals live in Rust. Everything you touch day to day, the client, handlers, filters, is plain Python and can change without a recompile.
Prebuilt Wheels for your platform
Wheels ship prebuilt for Linux (x86_64, aarch64), macOS (x86_64, arm64), Windows (x86_64), and Android/Termux (aarch64, x86_64). pip install ferogram grabs the right one on its own.
License
This project is dual-licensed under:
- MIT License
- Apache License 2.0
You may choose either license.
You are free to use, modify, and distribute this software, including for commercial use, provided the original license and copyright notice are included.
See LICENSE-MIT and LICENSE-APACHE for full details.
Developer
Developed by Ankit Chaubey
Don't forget to explore the Rust engine powering ferogram-py: ferogram. Thanks for being part of the journey.
Join the ferogram community! Questions, discussions, bugs report and feedback are always welcome. As the project grows, we'll eventually split Python and Rust discussions into dedicated spaces.
-
Channel (releases & announcements): @Ferogram
-
(questions & discussion): @FerogramChat
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ferogram-0.5.3b2.tar.gz.
File metadata
- Download URL: ferogram-0.5.3b2.tar.gz
- Upload date:
- Size: 679.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29b843f983022f40ae1d0dfa1c4aed4931e1fff8cfe7cc23e374f19696a5e768
|
|
| MD5 |
120839eba8d4ed74d156218a35917299
|
|
| BLAKE2b-256 |
f8f94b23fb3ac0d5680bc13284134d0cba3f60d9a561dee16099d3f7efc2c43f
|
File details
Details for the file ferogram-0.5.3b2-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: ferogram-0.5.3b2-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 6.3 MB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9464ffaa3214be06cded181b06ba49dfac01c7b38f64175255cfd6747037bfb0
|
|
| MD5 |
95da40ec6c0961561798f10afe7e9105
|
|
| BLAKE2b-256 |
24e50677365f897e8f7760de1708fd33b7d1d781f7f1be12d8f45df00216ef35
|
File details
Details for the file ferogram-0.5.3b2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: ferogram-0.5.3b2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 6.0 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba70b0c5f75a7de9ceff1a4d4de0506ebbf059ecdae1855679762a1b1f355cd1
|
|
| MD5 |
f4204f81fcd497f42e651baacbb213e0
|
|
| BLAKE2b-256 |
74fd240eff34caacf246884ff96a43ac98ad5fea78529e9b2feab756d0383c06
|
File details
Details for the file ferogram-0.5.3b2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: ferogram-0.5.3b2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 5.6 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecf6290b93e71eccef4cd35af11e3e0f4ff65c7074a376edd2e8b520e4376a6b
|
|
| MD5 |
b24fddd6431a54f9e9fc3ccdc956d68d
|
|
| BLAKE2b-256 |
32c1f67f099add3b693a707a55cf4573e10ba78435d862c47e1cfa05ed1fc13b
|
File details
Details for the file ferogram-0.5.3b2-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: ferogram-0.5.3b2-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da01ebd085be0671dc19573ec29b9aad5a282b1bcb3e6b51c70dd33556fa3532
|
|
| MD5 |
7b905abcdd929d7d3438db0c289dae5d
|
|
| BLAKE2b-256 |
76f8aaaf8110db7aef58c19aece4bd60296b6cf23da2d54af5f613e46503d05f
|
File details
Details for the file ferogram-0.5.3b2-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: ferogram-0.5.3b2-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 5.8 MB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85ee0b831a69826729033f76ced40013b1c0ff68451260ab63a89c956f245205
|
|
| MD5 |
61549e0f6083e73f236a4ee13ceaaf47
|
|
| BLAKE2b-256 |
1b0279584a1a96b097476a435890f8fa32abb4b5869b88a801f3b26f335deb07
|
File details
Details for the file ferogram-0.5.3b2-cp39-abi3-android_24_x86_64.whl.
File metadata
- Download URL: ferogram-0.5.3b2-cp39-abi3-android_24_x86_64.whl
- Upload date:
- Size: 5.9 MB
- Tags: Android API level 24+ x86-64, CPython 3.9+
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7496ebf86686c628f2ebd728a3db64dc72ac4bd9951036c2e7bc0c248868f4ea
|
|
| MD5 |
db2e3280850f4021aa49f6f82858a42c
|
|
| BLAKE2b-256 |
90784e22f40aa2ccb8327f4b56167f41cfb9d222a5de5ad25dda32be3a3dcfa9
|
File details
Details for the file ferogram-0.5.3b2-cp39-abi3-android_24_x86.whl.
File metadata
- Download URL: ferogram-0.5.3b2-cp39-abi3-android_24_x86.whl
- Upload date:
- Size: 5.7 MB
- Tags: Android API level 24+ x86, CPython 3.9+
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c0bcfd0e0e75e3562b5830efc7367f2e477304333725cf75763fb818715570f
|
|
| MD5 |
90fd273b28b2029956cc80ca9296de4b
|
|
| BLAKE2b-256 |
811e2c46a6a28a87132bdea53ee0707d8c40100a5a001b84b8d91c86347116fc
|
File details
Details for the file ferogram-0.5.3b2-cp39-abi3-android_24_armeabi_v7a.whl.
File metadata
- Download URL: ferogram-0.5.3b2-cp39-abi3-android_24_armeabi_v7a.whl
- Upload date:
- Size: 5.1 MB
- Tags: Android API level 24+ ARM EABI v7a, CPython 3.9+
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cf0c43fa7962dd27b69964cb354e32c57768f79ad8c19ff65c5ca0ea5b64237
|
|
| MD5 |
e1aca927a7d45a682a229d69438b5a8f
|
|
| BLAKE2b-256 |
7d6245a427f5861c33d8d6edcb1f04e9a208adf773df9af3fc7459d6eb574928
|
File details
Details for the file ferogram-0.5.3b2-cp39-abi3-android_24_arm64_v8a.whl.
File metadata
- Download URL: ferogram-0.5.3b2-cp39-abi3-android_24_arm64_v8a.whl
- Upload date:
- Size: 5.5 MB
- Tags: Android API level 24+ ARM64 v8a, CPython 3.9+
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fdddb52941e97c6a79996a2c5fd2e47a180a2b8bc9846c69fc1d25388f4d9a2
|
|
| MD5 |
ddea4e4c93590c0b053daf7e0058f1d7
|
|
| BLAKE2b-256 |
02ca2168ed5aaccc3ad2a6cdc2302f90ead9a36c23fdb7bb173a8cd890ca0537
|