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

Uploaded CPython 3.9+Windows x86-64

ferogram-0.5.0-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.0-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.0-cp39-abi3-macosx_11_0_arm64.whl (4.0 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

ferogram-0.5.0-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.0-cp39-abi3-android_24_x86_64.whl (4.3 MB view details)

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

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

Uploaded Android API level 24+ x86CPython 3.9+

ferogram-0.5.0-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.0-cp39-abi3-android_24_arm64_v8a.whl (4.1 MB view details)

Uploaded Android API level 24+ ARM64 v8aCPython 3.9+

File details

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

File metadata

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

File hashes

Hashes for ferogram-0.5.0.tar.gz
Algorithm Hash digest
SHA256 3490e4aca13861775da0300acceac0dbf042d3aea7fff473bb644dd9ee9f498e
MD5 d1a87141b2eaa29dfbeb213ee8c40fec
BLAKE2b-256 8c59ecfbd47591813a6379a0f131742731b8f449085798bea07de9ebada3484c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ferogram-0.5.0-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.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 6f40f71dc926fadba242ad8f07d893af0967b6929639a4e24b08deab44137391
MD5 24663247ab99321b3c7b40e65541eb03
BLAKE2b-256 e52917ea21caf4bc71bc3bdfec9ab0ce85641de82c76bc5338187c24fddb849b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ferogram-0.5.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 843a6f62a2cdb1d12104f6db604cc4fd56ccca2fd204b9dc191c8acbd99d5286
MD5 47a4e5c1da12fdf63ab716de06000b55
BLAKE2b-256 e704edf4524b13167bebfbaa527e64fb8d8ec1c0c70046121beb63c772e3fc68

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ferogram-0.5.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f3e56749e62703601dd4910a251bd33dbbae03c408b7b5131defd22034fb0e0c
MD5 4057402f66abbd79dd204846b51f573a
BLAKE2b-256 fb729e4858bde7e2888a812d035272a695ab2e9544f2ae10dc705537f1945a3f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ferogram-0.5.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f5e892cfb31bf4de5964df2c7a49c88d9f318c044b14ddfa8ff4d6a91d683dd4
MD5 b28984b05098bfa15ff354d3aa8f7ad1
BLAKE2b-256 4e0506eac12e5bd4891f822640c21a0ba7e08d9a822cb5ebd0e6b8cf803caf89

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ferogram-0.5.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 62d0611fb61af3e94415334ee4d91e3da5a1704d078a346f5bb0b4d0c689043f
MD5 23e4fee6fd0f0df5bc2ce2b36580120f
BLAKE2b-256 7eb5974387ed53d22b84dc5cf0b47b9e5dfc846877aeffd7d7ac57c36687f8f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ferogram-0.5.0-cp39-abi3-android_24_x86_64.whl
Algorithm Hash digest
SHA256 fa7e83aa55ff9470c6fd23fad209e8b11c064a381c9248398ed52c198762593e
MD5 14c69c86f6a0e14da44d1a3d34ebf37e
BLAKE2b-256 5f2f192610bb439de17bc9c18ec0ef768c95f361db406f09695686a24e18d7e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ferogram-0.5.0-cp39-abi3-android_24_x86.whl
Algorithm Hash digest
SHA256 72b29db5385883628f55e5412a5a59d870c625d72935c1213ec12d244787bca5
MD5 07d435edec29f528416f19763cf363fd
BLAKE2b-256 a21c222e76657ed7a39a23701e009310d44c66b8276ee9c0aefe6dde33730fe4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ferogram-0.5.0-cp39-abi3-android_24_armeabi_v7a.whl
Algorithm Hash digest
SHA256 f0ee8400560960b5b7856f39900de8d5282dc0aa7dca3ef2397754fb11e7d34c
MD5 5291a30df18d64877a0d04e8ee155f6b
BLAKE2b-256 a1558105bb56c2b80eab8e84df85c11dd7f26e52221ecee08009ee03f07e769a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ferogram-0.5.0-cp39-abi3-android_24_arm64_v8a.whl
Algorithm Hash digest
SHA256 188a3e91a5ddb7516894b874bebe4529758c5cfccac5d9cf93e0370ed856810b
MD5 872d81f0656fe904ae4c6fec2f6387b2
BLAKE2b-256 3019d9fafb3dfae143f0162b402ca97587bd22cd5102420d4b9a016a5f3a4c53

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