Migration from v0.3.x

In v0.4.x, pykeyboard and pyrogram_patch were merged into the unified kurigram_addons namespace. Old import paths still work for backward compatibility, but we recommend updating to the new imports.

Import Changes

Everything is now available from a single package:

Before (v0.3.x)
# Keyboards — separate pykeyboard package
from pykeyboard import InlineKeyboard, InlineButton
from pykeyboard import ReplyKeyboard, ReplyButton

# Routing — separate pyrogram_patch package
from pyrogram_patch.router import Router
from pyrogram_patch import patch, StopPropagation

# FSM & Storage — deep imports
from pyrogram_patch.fsm import StateItem, StatesGroup
from pyrogram_patch.fsm.storages import MemoryStorage
from pyrogram_patch.fsm.storages import RedisStorage
⬇️ becomes ⬇️
After (v0.4.x)
# Everything from one package
from kurigram_addons import (
    # Client
    KurigramClient,

    # Keyboards
    InlineKeyboard, InlineButton,
    ReplyKeyboard, ReplyButton,

    # Routing & FSM
    Router, StateItem, StatesGroup,
    MemoryStorage, RedisStorage,

    # Utilities
    Conversation, ConversationState,
    Menu, parse_command, RateLimit, Depends,
)

Client Setup

The patch() function is replaced by KurigramClient:

Before (v0.3.x)
from pyrogram import Client
from pyrogram_patch import patch

app = Client("my_bot")
patched = patch(app)
⬇️ becomes ⬇️
After (v0.4.x)
from kurigram_addons import KurigramClient, MemoryStorage

app = KurigramClient(
    "my_bot",
    bot_token="...",
    storage=MemoryStorage(),
    auto_flood_wait=True,
)
app.run()

Breaking Changes in v0.4.1

ChangeBeforeAfter
parse_commandReturns empty dict on missing argsRaises CommandParseError
Menu._registryStrong references (leaks)WeakValueDictionary (auto-cleanup)
RateLimit bucketsUnbounded defaultdictBounded OrderedDict (max 10k, LRU)

Backward Compatibility

The old from pykeyboard import ... and from pyrogram_patch import ... paths still work. However, we recommend migrating to from kurigram_addons import ... for:

  • Simpler imports — one package instead of three
  • Consistent API — access to new features like KurigramClient, lifecycle hooks, and Conversation
  • Future-proof — legacy import paths may be deprecated in a future release