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.1.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.1-py3-none-any.whl (30.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pykeyboard_kurigram-0.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 66ff9ae57f69344b5e30ae9a927dea93da7a48bdb67515cc92dd0a655196b08a
MD5 a6f62cd29092569b7be34b6545855e54
BLAKE2b-256 d4bb773410512269247bbdb955eb023e01f0dee82d7f8bbe7066b54fff1711ac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pykeyboard_kurigram-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 30.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0eafa53dae63ba56c07b1e129aed7835c09e4d6efbc6dec6c608c7ba95d225ec
MD5 58fe169ffcf5e01db8f5904324e8971e
BLAKE2b-256 5a5498069d9a08564ba0cd27b14fa635b73722cfaf3f6d3114a3e505e026ac08

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