Skip to main content

aiogram-bincallback

PyPI version Python versions License aiogram

Bitwise serialization of CallbackData for aiogram 3.x instead of the text format prefix:field1:field2. Each field occupies a fixed number of bits - more data fits into the Telegram limit (64 bytes), and the payload size is known at class definition time.

Ru README

Installation

pip install aiogram-bincallback

Dependencies: aiogram>=3.0,<4.0, pydantic>=2.0,<3.0, Python 3.8+.

from enum import Enum, IntEnum

from aiogram_bincallback import BinaryCallbackData, bfield


class CbPrefix(IntEnum):
    ORDER = 1
    HOME = 2


class Status(str, Enum):
    PENDING = "pending"
    SHIPPED = "shipped"


class OrderCb(BinaryCallbackData, prefix=CbPrefix.ORDER.value, version=1):
    order_id: int = bfield(bits=16, signed=False)
    status: Status = bfield(bits=4)

prefix and version are class inheritance arguments, not model fields. Both are required.

cb = OrderCb(order_id=42, status=Status.PENDING)
packed = cb.pack()
restored = OrderCb.unpack(packed)

OrderCb is simultaneously a pydantic.BaseModel and an aiogram.CallbackData, used in filters like a regular CallbackData:

from aiogram import Router

router = Router()


@router.callback_query(OrderCb.filter())
async def handle_order(callback, callback_data: OrderCb):
    ...

Documentation

Metadata

Release files for aiogram-bincallback 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiogram-bincallback 0.3.2
File Size Uploaded Provenance Actions
aiogram_bincallback-0.3.2.tar.gz 31.3 kB With provenance Details for aiogram_bincallback-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aiogram-bincallback 0.3.2
File Interpreter ABI Platform Actions
aiogram_bincallback-0.3.2-py3-none-any.whl Python 3 none any Details for aiogram_bincallback-0.3.2-py3-none-any.whl

Total release size: 52.1 kB

Release files / aiogram_bincallback-0.3.2.tar.gz

Download URL aiogram_bincallback-0.3.2.tar.gz
Size 31.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5e7ec80744ac05e959a58556124ec535e2ab68ee34d842921b81c13d6be7fb99
BLAKE2b-256 checksum
How to use checksums
580fc6b0e7e2de4dc35ac84371ac19545c084f4d6198957615214cc77a0fc2b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 18, 2026.

Transparency log

Release files / aiogram_bincallback-0.3.2-py3-none-any.whl

Download URL aiogram_bincallback-0.3.2-py3-none-any.whl
Size 20.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8bea71a47d3b81b9f1a8d4aa8337eb07b271cff1f621bf3daddac8d15bf98295
BLAKE2b-256 checksum
How to use checksums
596008938ec553e3937a738455268591e9ea91e5937c191a5032143a1e38dde4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 18, 2026.

Transparency log

Security for aiogram-bincallback 0.3.2

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aiogram_bincallback-0.3.2.tar.gz

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 Jul 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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