Skip to main content

Best Keyboard and Pagination for the Kurigram Library.

Project description

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 PresetsKeyboardFactory for one-line confirmation, menu, rating, pagination, and language keyboards
  • 🪝 Hooks & ValidationButtonValidator 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

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

pykeyboard_kurigram-0.3.2.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

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

pykeyboard_kurigram-0.3.2-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

Details for the file pykeyboard_kurigram-0.3.2.tar.gz.

File metadata

  • Download URL: pykeyboard_kurigram-0.3.2.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.12 Linux/6.14.0-1017-azure

File hashes

Hashes for pykeyboard_kurigram-0.3.2.tar.gz
Algorithm Hash digest
SHA256 a1ebd7f03c04b5b9dbc8f1b7904116c2b983e46ede326a519ce8df045e5f12d8
MD5 416bb6ffd801b817aea9f6613f16cfc3
BLAKE2b-256 de9290799db5c566deb94d6b38c8b8fd7dffdca7d00e2ff8d00d0ecc0ad51818

See more details on using hashes here.

File details

Details for the file pykeyboard_kurigram-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: pykeyboard_kurigram-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 30.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.12 Linux/6.14.0-1017-azure

File hashes

Hashes for pykeyboard_kurigram-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2e55a2f71b2c6c037c39dac8de4c6c4abd09f5d9da4b2eee410f89defb8dbdc5
MD5 145a261df4e79c630e893bf10e3089f9
BLAKE2b-256 63e1a657c63d487c9b05472a5060a521302b2e15760549d5e9db167f75dfb089

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