Skip to main content

ferogram-py

PyPI Python Downloads License Telegram

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

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ferogram-0.5.4.tar.gz (669.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ferogram-0.5.4-cp39-abi3-win_amd64.whl (4.0 MB view details)

Uploaded CPython 3.9+Windows x86-64

ferogram-0.5.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

ferogram-0.5.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.6 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

ferogram-0.5.4-cp39-abi3-macosx_11_0_arm64.whl (3.5 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

ferogram-0.5.4-cp39-abi3-macosx_10_12_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

ferogram-0.5.4-cp39-abi3-android_24_x86_64.whl (3.8 MB view details)

Uploaded Android API level 24+ x86-64CPython 3.9+

ferogram-0.5.4-cp39-abi3-android_24_x86.whl (3.8 MB view details)

Uploaded Android API level 24+ x86CPython 3.9+

ferogram-0.5.4-cp39-abi3-android_24_armeabi_v7a.whl (3.5 MB view details)

Uploaded Android API level 24+ ARM EABI v7aCPython 3.9+

ferogram-0.5.4-cp39-abi3-android_24_arm64_v8a.whl (3.6 MB view details)

Uploaded Android API level 24+ ARM64 v8aCPython 3.9+

File details

Details for the file ferogram-0.5.4.tar.gz.

File metadata

  • Download URL: ferogram-0.5.4.tar.gz
  • Upload date:
  • Size: 669.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for ferogram-0.5.4.tar.gz
Algorithm Hash digest
SHA256 841a92c47d7b8f1baa589a3bd1892bb2a555e6e41eeca2576bf3173a4ee388c7
MD5 3b6d4a22f8e06f3502a36424aaea8e2d
BLAKE2b-256 80e8983c997e024e3bf556c6fe3530afe9cb46636380118170f9b6f46d60f784

See more details on using hashes here.

File details

Details for the file ferogram-0.5.4-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: ferogram-0.5.4-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 4.0 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for ferogram-0.5.4-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9dab02667e37aea075ce2932ba1ddab8ac3be176c275b5d825b479004aba6e39
MD5 05927934cbfa65339bf6ac3319fc2709
BLAKE2b-256 8ff24a20fcc3798a7b2450e68d20ce7847182b635ed6e63ce3b9c01fa6e741bf

See more details on using hashes here.

File details

Details for the file ferogram-0.5.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ferogram-0.5.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3f99442c654adbba08c282f2468f91b9484c55d5c3d65047e19ff44aaa29c473
MD5 e1cc4e77757eea19d4a9e8f452d6c8be
BLAKE2b-256 cd2830f74b719150bb2a859f4ac57750e6896c69d742a5fee9eb434de5fd7152

See more details on using hashes here.

File details

Details for the file ferogram-0.5.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for ferogram-0.5.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a4015937dd98534b8f51f612d088d5487322cda3b42931cd96458223c3ac534a
MD5 9afac416287d30150de1882a84e46bde
BLAKE2b-256 70a1e9c7dfdde9581ddf8410a8113a2bc4aeafb1717b4d86de4fa28b336acfcf

See more details on using hashes here.

File details

Details for the file ferogram-0.5.4-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ferogram-0.5.4-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d1b6a0ab68cfe42627a5733031b16a3db4216220c36fd42e6dbb5f02adb3d8f1
MD5 9d1e18965828be0fb0fad23c3d62d854
BLAKE2b-256 7b7886392aceef55f5d0ba9d6d55f2b66d9d7cda56a07650f8b5cc99d70b05bd

See more details on using hashes here.

File details

Details for the file ferogram-0.5.4-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ferogram-0.5.4-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c71fc3b1adaff4e6dd7f2449686343dcb51655e57a47ad85587b740bfd7fed30
MD5 3cb82f7741e0c2dd4373b6221a8a73c5
BLAKE2b-256 2450970233129448c87a71e9591884748c5401096d9ebdc7d51b84db391f2dfe

See more details on using hashes here.

File details

Details for the file ferogram-0.5.4-cp39-abi3-android_24_x86_64.whl.

File metadata

File hashes

Hashes for ferogram-0.5.4-cp39-abi3-android_24_x86_64.whl
Algorithm Hash digest
SHA256 d7a655625481731a86f64a1be526a64c015abaf3ce95452e239027dce8cbab60
MD5 9f4ebc387d02eaacd6a7dcae5dd99772
BLAKE2b-256 d4cc24cdde81fba260c818f873b06b9672ee810ba38f8bac09cf957c01876b2a

See more details on using hashes here.

File details

Details for the file ferogram-0.5.4-cp39-abi3-android_24_x86.whl.

File metadata

File hashes

Hashes for ferogram-0.5.4-cp39-abi3-android_24_x86.whl
Algorithm Hash digest
SHA256 7a7b4e887240ad7a28fb024bcf8c6d5df1ba1fb10e0f2687c95081d1b8604f9b
MD5 fb028ac49107d3e2b7ebcb089198da8d
BLAKE2b-256 a96f7551d3b25671bce5ea66923f10e9bbfe468e433745a1f3c4e82099364895

See more details on using hashes here.

File details

Details for the file ferogram-0.5.4-cp39-abi3-android_24_armeabi_v7a.whl.

File metadata

File hashes

Hashes for ferogram-0.5.4-cp39-abi3-android_24_armeabi_v7a.whl
Algorithm Hash digest
SHA256 b2eaa7cb20a7896049479c4f507ecba2cacac32aeac90d5452fc0481537eb0f3
MD5 b13b709a4547d1e090e8be41be2db9d8
BLAKE2b-256 b989b3791e64eb0d2431343087d944493954ccb412bdfd4cfb661d323ed8faef

See more details on using hashes here.

File details

Details for the file ferogram-0.5.4-cp39-abi3-android_24_arm64_v8a.whl.

File metadata

File hashes

Hashes for ferogram-0.5.4-cp39-abi3-android_24_arm64_v8a.whl
Algorithm Hash digest
SHA256 52340f39a7039f9216b8706217b1a7a3624ee15d9d4f23751b98365e82c4c227
MD5 879a11d12d2f0e9e31e70a1099641907
BLAKE2b-256 f84790f134ca739c5c539ec7283be3b9f48b1cbc268ec0e349171e012e8724f1

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.4 This release

10 files

0.5.3

10 files

0.5.2

10 files

0.5.1

10 files

0.5.0

10 files

0.4.1

10 files

0.4.0

10 files

0.3.0

10 files

0.2.3

10 files

0.2.2

10 files

0.2.1

10 files

0.2.0

10 files

0.1.9

10 files

0.1.8

10 files

0.1.7

10 files

0.1.6

10 files

0.1.5

10 files

0.1.4

10 files

0.1.3

10 files

0.1.2

10 files

0.1.1

10 files

0.1.0

6 files

0.0.0

2 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