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.0.tar.gz (26.0 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.0-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pykeyboard_kurigram-0.3.0.tar.gz
  • Upload date:
  • Size: 26.0 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.0.tar.gz
Algorithm Hash digest
SHA256 7b69b4aa92d7a6fb8c342cb052c4044d68b1b0a815859a704a522b856c988c0a
MD5 1910ead6b3f8d3de4e6f4ff241bfcba2
BLAKE2b-256 76c502950e2322b54568cb04f1dd89802a45b5fcd2458af44da5714bcdcd8b8a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pykeyboard_kurigram-0.3.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ffeedab086b88fde8cbec97e2a219e549baf314a2d3ed6e0c298211b0aff6e2
MD5 d03383328a9f5a298ab5963d61696d34
BLAKE2b-256 61aba2ebdc8c7e21b8045701f800a4aba50e1e5f018dc63f9e3620ea32acd5b8

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