Skip to main content

Python MTProto library powered by ferogram, a high-performance Rust engine for Telegram.

Project description

ferogram-py

A Python MTProto library powered by the Rust-based ferogram engine, delivering near-native performance with minimal Python overhead.

Built with PyO3 and maturin. Works on Linux, macOS, Windows, and Android (Termux).


Why ferogram-py?

ferogram-py combines Python's simplicity with the speed and efficiency of a native Rust implementation.

Performance-critical components such as networking, encryption, session management, and MTProto internals run natively in Rust, reducing Python overhead while exposing a clean and Pythonic API.

Whether you're building userbots, bots, or automation tools, ferogram-py provides both high-level abstractions and direct access to raw Telegram APIs when needed.

Quick API reference: FEATURES.md


Install

pip install ferogram

Pre-built wheels are available for Linux (x86_64, aarch64), macOS (x86_64, arm64), Windows (x86_64), and Android/Termux (aarch64, x86_64).

pip install ferogram picks the correct wheel automatically.


Build from source

Clone the repository, then run:

make dev      # editable install into .venv (builds Rust extension)
make build    # release wheel for this machine
make codegen  # regen TL generated code without a Rust build
make test     # run tests
make clean    # remove .venv, target, dist, generated/

Termux prerequisites: pkg install rust clang python

To skip TL codegen on a Rust-only change: FEROGRAM_SKIP_CODEGEN=1 maturin develop

Quick start

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()

Credentials can also come 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) is intentionally minimal. Networking, encryption, session management, and MTProto internals are implemented in Rust, while the high-level API remains entirely in Python and can be updated without recompiling rust core.


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, and feedback are always welcome. As the project grows, we'll eventually split Python and Rust discussions into dedicated spaces.

Project details


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.1.tar.gz (632.0 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.1-cp39-abi3-win_amd64.whl (4.5 MB view details)

Uploaded CPython 3.9+Windows x86-64

ferogram-0.5.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.3 MB view details)

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

ferogram-0.5.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.1 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

ferogram-0.5.1-cp39-abi3-macosx_11_0_arm64.whl (4.0 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

ferogram-0.5.1-cp39-abi3-macosx_10_12_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

ferogram-0.5.1-cp39-abi3-android_24_x86_64.whl (4.3 MB view details)

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

ferogram-0.5.1-cp39-abi3-android_24_x86.whl (4.3 MB view details)

Uploaded Android API level 24+ x86CPython 3.9+

ferogram-0.5.1-cp39-abi3-android_24_armeabi_v7a.whl (3.8 MB view details)

Uploaded Android API level 24+ ARM EABI v7aCPython 3.9+

ferogram-0.5.1-cp39-abi3-android_24_arm64_v8a.whl (4.2 MB view details)

Uploaded Android API level 24+ ARM64 v8aCPython 3.9+

File details

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

File metadata

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

File hashes

Hashes for ferogram-0.5.1.tar.gz
Algorithm Hash digest
SHA256 788e0b10145da3c79bd58c7b9ae2df592213fa371d5a0176155de0954943543c
MD5 29d48c5e0d2157d1cc6de135057dc940
BLAKE2b-256 28212b8b137aea770fa382eb25c2616db878a0f6d8c331cc77ad564714f725aa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ferogram-0.5.1-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 4.5 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.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f0780f3640a0d0536918b59881630512c14dab3792fa14701fe4eb52498d939d
MD5 e617a68da1f0589e850845867c270e02
BLAKE2b-256 09a82975a5eb8ad5bbb3b878fa787c39f099181b7e7582316141554441acc6e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ferogram-0.5.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 111807ab580ad54a121e3715401781ec9f2b3abc59a7a53a4cf53c48cc687ecb
MD5 e012ff05a5dd3b4e3644eb934e9c4fbf
BLAKE2b-256 287adc0eee084228d58e4253de663819e6da6d3db0ca54ed644ded6c645125b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ferogram-0.5.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4c9df3e47fe58f2eaf00cdb8e6103b641b55c85eb0c877fd6d79395ee7e87223
MD5 bfd5582a61bce6b93e721a937718900c
BLAKE2b-256 2c89057338539bd8c6fe2ebf712b1c083b386b39c3bb6d0315eedfc2801bc6e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ferogram-0.5.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 775284dff74d4f33294b73db02e1f97d0c96cd32e8c6ba6e083ebf31869ebc6b
MD5 77170263d7c0c4d78252cf18f1ba5c7d
BLAKE2b-256 4b8a735852db76324909e58cfbe6016731a4a8399496af4acf1366a1d0959fbf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ferogram-0.5.1-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 307697404056d3e12f50203466c79ae469afa233855c9053ab35330058bec822
MD5 5184d6ea02d0e6d5a21e9e733a1481a5
BLAKE2b-256 9aca5d982dc48607636e471da3e926419349614c32ae8c2fb61a04788d254235

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ferogram-0.5.1-cp39-abi3-android_24_x86_64.whl
Algorithm Hash digest
SHA256 fa63ee7495bfa8d824cf9ecc26a4ae924723721e3b88b2afb10f59ff2dcef343
MD5 9569265b086476e3bb321ddd764b02eb
BLAKE2b-256 8f113d7f062a00dd1f5adb751171407b4a73b543764533ddaf9ac12414aabc7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ferogram-0.5.1-cp39-abi3-android_24_x86.whl
Algorithm Hash digest
SHA256 dfa72573bbe099839c5fb4eae19d793fe5729945fcfa4086eb916266cdd26da3
MD5 91809c520ace8cbb9b20b7f9801f28a8
BLAKE2b-256 509b84fd62d289f53263bb98d96df921bbd40eb86d9936572c502e6ec94af7f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ferogram-0.5.1-cp39-abi3-android_24_armeabi_v7a.whl
Algorithm Hash digest
SHA256 6909baf89eb54c02a0f838f03c7272466265f7b6d0a61628fe3299074e133d6e
MD5 998fea1c652e9f71a68671104403945d
BLAKE2b-256 f5ab5057e347984c6b749136b42add62bdc1acb01aa89f9141425a40b6ee51f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ferogram-0.5.1-cp39-abi3-android_24_arm64_v8a.whl
Algorithm Hash digest
SHA256 e588b2e6bcdd8fde2346963f7e11377594af2c19e85d2e183ddf93bfea380b47
MD5 de81f56b57b4114c64c3376b46c9757c
BLAKE2b-256 16dd7ecd069138f318b75231133cf2561ba9a63f2fa8b30294672dc9e58048ec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page