Skip to main content

ioredis-style (pipeline-oriented) Redis state adapter for chat-py

Project description

chat-adapter-state-ioredis

ioredis-flavoured Redis state adapter for chat-py. Python port of upstream packages/state-ioredis.

Why this package exists

In Node.js, upstream ships two separate state packages — @chat-sdk/state-redis (wraps the modern redis / node-redis client) and @chat-sdk/state-ioredis (wraps the legacy ioredis client). Python has no such split: redis.asyncio is the canonical async client. So this package is a thin subclass of RedisStateAdapter — behaviour is identical; the only difference is the lock-token prefix (ioredis_ vs redis_), which matches upstream byte-for-byte so a single Redis instance can host mixed Python / TypeScript clients that inspect the token prefix.

Install

uv add chat-py-adapter-state-ioredis

Minimal example

from chat import Chat
from chat_adapter_state_ioredis import create_ioredis_state
from chat_adapter_slack import create_slack_adapter

bot = Chat(
    user_name="mybot",
    adapters={"slack": create_slack_adapter()},
    state=create_ioredis_state(url="redis://localhost:6379"),
)

All other config (client injection, key prefix) is inherited from chat-adapter-state-redis — see that package's README.

Parity notes

  • See chat-adapter-state-redis for the full implementation. The only override is acquire_lock, which emits ioredis_<ts>_<hex> tokens instead of redis_<ts>_<hex>.

Test

uv run pytest packages/chat-adapter-state-ioredis

# Live — shares REDIS_URL with state-redis
REDIS_URL=redis://localhost:6379 uv run pytest packages/chat-integration-tests -k ioredis

Upstream

https://github.com/vercel/chat/tree/main/packages/state-ioredis

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

chat_py_adapter_state_ioredis-0.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file chat_py_adapter_state_ioredis-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: chat_py_adapter_state_ioredis-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.20 {"installer":{"name":"uv","version":"0.9.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for chat_py_adapter_state_ioredis-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 749b5208eff190834e1fd494b5c9e076fbef49b45610ebed1f8f0d65e01a9fed
MD5 06a9948569fbb0c2a1fdf24b72707c11
BLAKE2b-256 bd3de4fa51cd3ab230219daa0239c04df0d0f5821eefc8635c73ae54c68a08d5

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