Skip to main content

pykeyboard

PyPI Downloads Python Version License

PyKeyboard

Best Keyboard Library for Kurigram

PyKeyboard is a comprehensive Python library for creating beautiful and functional inline and reply keyboards for Telegram bots using Kurigram.

Features

  • 🎯 Inline & Reply Keyboards — full Pyrogram-compatible button types (URL, callback, contact, location, web app, etc.)
  • 📄 Pagination — automatic page navigation with duplicate-prevention and LRU caching
  • 🌍 50+ Languages — built-in locale support with native names, flags, and custom locale registration
  • 🏗️ Builder Pattern — fluent KeyboardBuilder API with method chaining for complex layouts
  • 🏭 Factory Presets — KeyboardFactory for one-line confirmation, menu, rating, pagination, and language keyboards
  • 🪝 Hooks & Validation — ButtonValidator and KeyboardHookManager for rule-based button validation and transforms
  • 🚨 Structured Errors — typed error classes with error_code, param, value, and reason attributes

Installation

# Using pip
pip install pykeyboard-kurigram

# Using poetry
poetry add pykeyboard-kurigram

# Using uv
uv add pykeyboard-kurigram

Quick Start

Inline Keyboard

from pykeyboard import InlineKeyboard, InlineButton

keyboard = InlineKeyboard()
keyboard.add(
    InlineButton("👍 Like", "action:like"),
    InlineButton("👎 Dislike", "action:dislike"),
    InlineButton("📊 Stats", "action:stats")
)

await message.reply_text("What do you think?", reply_markup=keyboard)

Builder Pattern

from pykeyboard import KeyboardBuilder, InlineKeyboard

kb = (
    KeyboardBuilder(InlineKeyboard())
    .add_row("🏠 Home", "⚙️ Settings")
    .add_row("📊 Stats", "🆘 Help")
    .add_navigation_buttons(10, 5, "page_{number}")
    .build()
)

Error Handling

from pykeyboard import InlineKeyboard, PyKeyboardError

try:
    kb = InlineKeyboard(row_width=0)
except PyKeyboardError as e:
    print(e.error_code)  # "CONFIGURATION_ERROR"
    print(e.param)       # "row_width"
    print(e.value)       # 0

Showcase Bot

A fully tested showcase bot demonstrating every feature is included in the repository:

export TELEGRAM_BOT_TOKEN="..."
export TELEGRAM_API_ID="..."
export TELEGRAM_API_HASH="..."
python showcase_bot.py

See showcase_bot.py for the complete source.

Documentation

For comprehensive documentation, see the docs or check the showcase_bot.py file for sequential usage examples.

License

This project is licensed under the MIT License - see the LICENSE file for details.


Made with ❤️ for the Telegram bot development community

Metadata

Release files for pykeyboard-kurigram 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 pykeyboard-kurigram 0.3.2
File Size Uploaded Provenance Actions
pykeyboard_kurigram-0.3.2.tar.gz 25.9 kB Without provenance Details for pykeyboard_kurigram-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pykeyboard-kurigram 0.3.2
File Interpreter ABI Platform Actions
pykeyboard_kurigram-0.3.2-py3-none-any.whl Python 3 none any Details for pykeyboard_kurigram-0.3.2-py3-none-any.whl

Total release size: 56.4 kB

Release files / pykeyboard_kurigram-0.3.2.tar.gz

Download URL pykeyboard_kurigram-0.3.2.tar.gz
Size 25.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a1ebd7f03c04b5b9dbc8f1b7904116c2b983e46ede326a519ce8df045e5f12d8
BLAKE2b-256 checksum
How to use checksums
de9290799db5c566deb94d6b38c8b8fd7dffdca7d00e2ff8d00d0ecc0ad51818
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.12.12 Linux/6.14.0-1017-azure

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

Download URL pykeyboard_kurigram-0.3.2-py3-none-any.whl
Size 30.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e55a2f71b2c6c037c39dac8de4c6c4abd09f5d9da4b2eee410f89defb8dbdc5
BLAKE2b-256 checksum
How to use checksums
63e1a657c63d487c9b05472a5060a521302b2e15760549d5e9db167f75dfb089
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.12.12 Linux/6.14.0-1017-azure

Security for pykeyboard-kurigram 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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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