Skip to main content

Python wrapper for redis-rs

Project description

https://img.shields.io/badge/License-MIT-blue.svg https://img.shields.io/pypi/v/redis-rs.svg Python versions Documentation Status https://github.com/aamalev/redis-rs-py/workflows/Tests/badge.svg https://img.shields.io/pypi/dm/redis-rs.svg

https://img.shields.io/badge/Rustc-1.73.0-blue?logo=rust https://img.shields.io/badge/cargo-clippy-blue?logo=rust https://img.shields.io/badge/PyO3-maturin-blue.svg https://img.shields.io/badge/PyO3-asyncio-blue.svg Linter: ruff Code style: ruff Code style: Mypy Hatch project
Python wrapper for:
redis_cluster_async,
bb8-redis,
bb8-redis-cluster,
deadpool-redis-cluster,

Features

  • Async client for single and cluster

  • Support typing

  • Encoding values from str, int, float

  • Decoding values to str, int, float, list, dict

Install

pip install redis-rs

Using

import asyncio
import redis_rs


async def main():
    async with redis_rs.create_client(
        "redis://redis-node001",
        "redis://redis-node002",
        max_size=1,
        cluster=True,
    ) as x:
        info = await x.execute("INFO", "SERVER", encoding="info")
        print(info["redis_version"])

        print(await x.execute(b"HSET", "fooh", "a", b"asdfg"))
        print(await x.fetch_int("HSET", "fooh", "b", 11234567890))
        print(await x.fetch_int("HGET", "fooh", "b"))
        print(await x.fetch_str("HGET", "fooh", "a"))
        print(await x.fetch_dict("HGETALL", "fooh", encoding="utf-8"))
        print(await x.hgetall("fooh", encoding="utf-8"))
        print(await x.execute("CLUSTER", "NODES"))
        print(await x.fetch_bytes("GET", "foo"))
        print(await x.fetch_int("GET", "foo"))
        print(await x.execute("HGETALL", "fooh"))
        print(await x.execute("ZADD", "fooz", 1.5678, "b"))
        print(await x.fetch_scores("ZRANGE", "fooz", 0, -1, "WITHSCORES"))
        print(x.status())

        stream = "redis-rs"
        print("x.xadd", await x.xadd(stream, "*", {"a": "1234", "d": 4567}))
        print("x.xadd", await x.xadd(stream, items={"a": "1234", "d": 4567}))
        print("x.xadd", await x.xadd(stream, {"a": "1234", "d": 4567}))
        print("x.xadd", await x.xadd(stream, "*", "a", "1234", "d", 4567))
        print("x.xadd", await x.xadd(stream, "a", "1234", "d", 4567))
        print("xadd", await x.fetch_str("XADD", stream, "*", "a", "1234", "d", 4567))
        print("xread", await x.execute("XREAD", "STREAMS", stream, 0))
        print("xread", await x.fetch_dict("XREAD", "STREAMS", stream, 0, encoding="int"))
        print("x.xread", await x.xread({stream: 0}, encoding="int"))
        print("x.xread", await x.xread(stream, id=0, encoding="int"))
        print("x.xread", await x.xread(stream, stream))


asyncio.run(main())

Development

cargo fmt
cargo clippy
maturin develop

or use hatch envs:

hatch run fmt
hatch run check
hatch run build

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

redis_rs-0.9.0.tar.gz (30.2 kB view details)

Uploaded Source

Built Distributions

redis_rs-0.9.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

redis_rs-0.9.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

redis_rs-0.9.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

redis_rs-0.9.0-cp312-none-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.12Windows x86-64

redis_rs-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

redis_rs-0.9.0-cp312-cp312-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (3.6 MB view details)

Uploaded CPython 3.12macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

redis_rs-0.9.0-cp311-none-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.11Windows x86-64

redis_rs-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

redis_rs-0.9.0-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (3.6 MB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

redis_rs-0.9.0-cp310-none-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.10Windows x86-64

redis_rs-0.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

redis_rs-0.9.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (3.6 MB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

redis_rs-0.9.0-cp39-none-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.9Windows x86-64

redis_rs-0.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

redis_rs-0.9.0-cp38-none-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.8Windows x86-64

redis_rs-0.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file redis_rs-0.9.0.tar.gz.

File metadata

  • Download URL: redis_rs-0.9.0.tar.gz
  • Upload date:
  • Size: 30.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.3.1

File hashes

Hashes for redis_rs-0.9.0.tar.gz
Algorithm Hash digest
SHA256 5dae203bda3a44241bd4f13926020e7aa4354832d3b04b1528a5288a395a6589
MD5 1efdad64d5cb63ce7846b68f6fa6377b
BLAKE2b-256 4a1a7e136c625501b355497195f27e65a4f09132b540b639fcc610bc9e6ea8fb

See more details on using hashes here.

File details

Details for the file redis_rs-0.9.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for redis_rs-0.9.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6c72db552b572bebe3ef1f13e45af50eab2d295241f699cf89a7bc05af993375
MD5 42783fd031f90dd780153144eb7c5790
BLAKE2b-256 459aba3f2ea31028e574c04c6ea78fead0dd256e809a498a35fd8feb59aa769d

See more details on using hashes here.

File details

Details for the file redis_rs-0.9.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for redis_rs-0.9.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c7150fe47f4d0b73b4fb90e576593679831ca5e0b272a9c6a05590eecd786f65
MD5 721ba24cc09868fdf7295a61a1f58ce1
BLAKE2b-256 ed7b0493d2c22b2ab64605477ed69f080552fb4d3db51907ecfc4056492a2150

See more details on using hashes here.

File details

Details for the file redis_rs-0.9.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for redis_rs-0.9.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c0fd0a9e3d7754b9d3ee26efa1424081aa6a9a66d4070d58770620ee137080b9
MD5 544395a0050445a182e90b5f27c61a19
BLAKE2b-256 59beff6cc75d3452d20b2dcbd0cfcb227f6f96c772a2eb6f03615c936e91ecd6

See more details on using hashes here.

File details

Details for the file redis_rs-0.9.0-cp312-none-win_amd64.whl.

File metadata

  • Download URL: redis_rs-0.9.0-cp312-none-win_amd64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.3.1

File hashes

Hashes for redis_rs-0.9.0-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 c07ff013936a78f10616cb1dcb564d361856efcdcf5c314a72e0c3a334b60e5c
MD5 a7d9d843c219b355d1429f1a7c4c5a5b
BLAKE2b-256 6e7caf9812d5422cc8fdcda0fe90aecb702a1a07884134a15c053d2fe03cd574

See more details on using hashes here.

File details

Details for the file redis_rs-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for redis_rs-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 996f12de88e213520c9b92b7aa8cf27af44479949d596a772ed0b9b764cacd57
MD5 4e855572f4b84ec923daf48c6a26e06c
BLAKE2b-256 307a3330a396defe262de67c6e58490da9c122050314ed851b50fe57c8881bac

See more details on using hashes here.

File details

Details for the file redis_rs-0.9.0-cp312-cp312-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for redis_rs-0.9.0-cp312-cp312-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 402fae6346c26b07fa6b1894a8e89b791d414a231198ba5273f26bf1105d2ccd
MD5 be60a8d7c47d369ba2df2dc9c044188d
BLAKE2b-256 46292aadfeb9df9db8f5656ef38c5398ed78236980e47d23f84b2d010f5e5e85

See more details on using hashes here.

File details

Details for the file redis_rs-0.9.0-cp311-none-win_amd64.whl.

File metadata

  • Download URL: redis_rs-0.9.0-cp311-none-win_amd64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.3.1

File hashes

Hashes for redis_rs-0.9.0-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 a2977446efbdda1b62dce865b34807ce4be8c1c3cbfd8f232ff383c7f531bb34
MD5 adaa62838b6e5a20a8b7d7f7b24005bb
BLAKE2b-256 b1890c2fb0087907fb378e3534a607ab4b2ab29d785c0ad2222cb51c0ff7297c

See more details on using hashes here.

File details

Details for the file redis_rs-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for redis_rs-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 77565bc4527250ffecef5c3627853e795d54a780ecf7bd64a2252953ddfa0e20
MD5 d4a3b14a02a9ab42071e03f548cd010d
BLAKE2b-256 f7a11dc9303b71e99774e3ae023348938bb494cd762cee9b87f61dcd58cd981e

See more details on using hashes here.

File details

Details for the file redis_rs-0.9.0-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for redis_rs-0.9.0-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 0390cc2d6e2310e11b2d7ce50c07930c8b2e73802c3e445c29df81630a7e0024
MD5 0d646715855c4d4fbc5fe72c2267008c
BLAKE2b-256 f3d23cb0e203a458c2c41862a55e68f3570c5d9a0b7ae50438cdab13b01ffc87

See more details on using hashes here.

File details

Details for the file redis_rs-0.9.0-cp310-none-win_amd64.whl.

File metadata

  • Download URL: redis_rs-0.9.0-cp310-none-win_amd64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.3.1

File hashes

Hashes for redis_rs-0.9.0-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 0dfb722808cb94488f8f9aa38c2c48e15f5b6a8fd9c4a1990b276f3bd795c895
MD5 928d51c984bf4b302b8ecfe7643aa121
BLAKE2b-256 4e95d6ae19ce14a75cd4c4571f1c8989dcb3f4c5f450c89c9133c1c8eb6c8daf

See more details on using hashes here.

File details

Details for the file redis_rs-0.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for redis_rs-0.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 40dbecc38d5009be5bce031b356f2568773b3ea1e409621c1001280686e2d4ff
MD5 e419b7fe4d29aac8484e33a2a225c457
BLAKE2b-256 e70297c75ab9c0b0545c7e3b4dbea3a4a99c7c41ee1b29118e9573dad70d38a0

See more details on using hashes here.

File details

Details for the file redis_rs-0.9.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for redis_rs-0.9.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 24ada933c7756b6cc8e211fdae3975f039ad98051be8924645dd0010cde059d1
MD5 b0a432daf9f66989ab781ea2c11a67ee
BLAKE2b-256 c9dafa684f5617184a9e46f75849ca66a538d5705a6fb0c18e8e7348ba1f84db

See more details on using hashes here.

File details

Details for the file redis_rs-0.9.0-cp39-none-win_amd64.whl.

File metadata

  • Download URL: redis_rs-0.9.0-cp39-none-win_amd64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.3.1

File hashes

Hashes for redis_rs-0.9.0-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 2223035ec8fa51af9a76be11c481847670ccf48f95190c2bfd2790b051c21969
MD5 7c5ce9e75e268214dc5fe8356a80e4b4
BLAKE2b-256 61d069eea984aeaa206c3d288fa5086bcd5aa95a86d3b24d213a9efaad420947

See more details on using hashes here.

File details

Details for the file redis_rs-0.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for redis_rs-0.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 589ff26e21b1cb3dc113a60b436a52329cb4f9fb3c7bba058a84e1746ffc3710
MD5 7d29e49e6f4934b2bdd1c4c2927de3b5
BLAKE2b-256 3c1b1d08118d88f690798f8eee23f8ccb05da6af8e9abff926ce769d910db694

See more details on using hashes here.

File details

Details for the file redis_rs-0.9.0-cp38-none-win_amd64.whl.

File metadata

  • Download URL: redis_rs-0.9.0-cp38-none-win_amd64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.3.1

File hashes

Hashes for redis_rs-0.9.0-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 f23b7bb8fe594ce3f54f5e4703b38fc22233928fefa7f1dbdee84e2a502e96c9
MD5 db2e71cd8302837d6997f55dcf678a01
BLAKE2b-256 245d5bb1ed3312c35a2a0a2d47a6933b312086a97934ffab4142805e5d887452

See more details on using hashes here.

File details

Details for the file redis_rs-0.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for redis_rs-0.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0ef4b0bb20bf4e6e4c0f5e0937923dff12891bc50b1b9f1e1bda2ca61479256b
MD5 2f455dc202dd3951f66d36031dfcd616
BLAKE2b-256 225f82feaf9229596cb9a3f5a8dfdbdeced47f8d0650f5d8274482e5c90103b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page