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/PyO3-maturin-blue.svg https://img.shields.io/badge/PyO3-asyncio-blue.svg Code style: ruff Code style: black 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:
        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.6.11.tar.gz (19.3 kB view details)

Uploaded Source

Built Distributions

redis_rs-0.6.11-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

redis_rs-0.6.11-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

redis_rs-0.6.11-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

redis_rs-0.6.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.11Windows x86-64

redis_rs-0.6.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

redis_rs-0.6.11-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (3.4 MB view details)

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

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

Uploaded CPython 3.10Windows x86-64

redis_rs-0.6.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

redis_rs-0.6.11-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (3.4 MB view details)

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

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

Uploaded CPython 3.9Windows x86-64

redis_rs-0.6.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.8Windows x86-64

redis_rs-0.6.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

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

File metadata

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

File hashes

Hashes for redis_rs-0.6.11.tar.gz
Algorithm Hash digest
SHA256 78f93b0d57b2a04b71206a0905226f788e6b2d4d1e7791bfc766fc3d2aaa7060
MD5 82a833d2a478de3488ff6573bc848719
BLAKE2b-256 b6394a5448c27e3c4841b5e61195388524eeac4672ff5e3bc60de0f1f2cad0bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.6.11-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ea54fabd0222e7e6352458649cb4b030be139b6d2ff64cdcfed11ec9123c0784
MD5 7b6465bc2ddb1eab578e4f85bd9ba28d
BLAKE2b-256 336cb70c724f9dd93d9b426606d0c82bbaa74c8c1df9dbb5870c232cc8a377c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.6.11-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 060022ac8709f099463ef867510053901d96434d9c5dc45cad3966aabc781be0
MD5 508a0324f5d662b433f175765d75ee15
BLAKE2b-256 8676da11b1d003ebf367a5dd7c3213cc8a980a43317b4ad1caa402add3e5e440

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.6.11-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 234e245be17d361c684b453aa3fdbbbcaa3e319b6a00269e70c18ba68e890da8
MD5 e6f7c1c8f21460450e8bbaf737bb1797
BLAKE2b-256 eeff460e53e5896129556551c6a8dce6aa1ce085ecf723ba0784701b1208dfbc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.6.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 91d8f61ab6a0a69362d871aa977098a8baa45dce6ee64f5c87110d469d3854ce
MD5 e74b8959da73173077add3e8a01f3491
BLAKE2b-256 0743ed515af223f457c47d7fe9f4e208a5d520ac01ae6b41ee79f5ef5d532558

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.6.11-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 c5e351fe9da7f33ecec62499e203babeb69e24cf10c7b86eef7ef4ae139d2ba1
MD5 92f3f712d11d9c10087b1835b5a9954e
BLAKE2b-256 2c1735042ed1a3768a574bf0f63fed4317e7ccfcae494a7caab5aa13a40e5e8a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.6.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 99ee991a1d447c5b156104d09061a1813fb27f88b39cb5f0dca9daee1e9cf47f
MD5 6053e2c43ac66049d9b3053e6760cf0d
BLAKE2b-256 7cf128ecaef61e3d254d8f2b987684b463c86c2c76eb54e49b0ff879d66bae28

See more details on using hashes here.

File details

Details for the file redis_rs-0.6.11-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.6.11-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 a361926aee897ff25ca8236d3a11e392d8f6297e4a337df980e25ef9709776e9
MD5 561c06261c9494fa63afc67e304a1869
BLAKE2b-256 a94067ded4f2fd510999f53f7d9cfabb21d3c77a3a85e5132d88fd4f1f46acd4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.6.11-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 36479fe5bbd5c229514c3b5f7b720a8a1b705bcb163f7e6831d4c512bc29f64c
MD5 fdd3de0ea11d399b65f3f83232b1cb5b
BLAKE2b-256 de57f250c1e09d498bf95a75c55aed717a4c116fa87b2973d577b34b51c9295b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.6.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 56f6ce5c9c031e3aaa886439c4872c31ea1b9d39d6af0743d8fafb5a995ee787
MD5 2bd9f32474e97b205085f573c2d5773a
BLAKE2b-256 5be3fa2aa8577f5dd9cdcf76f68baaa786dbb0267ddc69916038dabdf49e4357

See more details on using hashes here.

File details

Details for the file redis_rs-0.6.11-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.6.11-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 99d214f49076c66b6e6d80cbc5743c70fa65ed551b26bd3c573fc1e3cc62ac27
MD5 09c12942624a6ce79c6174fd82e6cf78
BLAKE2b-256 6a59da620a3b3185d19c992da50d6e6f7a795fb26ee0165ad61418c5636d0f52

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.6.11-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 bb24326745f35b338cbcabfc07493ca0e096eacc4b4cac5015e0e4f7b77ec703
MD5 4aa4e7ea28ff5e27139b156e7f5933d6
BLAKE2b-256 579fdaf90ae0c819e923840c615865f0ce7d61ce17734b8b6a696a577cf5205d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.6.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 07ab53ed39c5b9efea2e0c4218ea3dde7717cd997c857cbc19c96ce954c5ebd2
MD5 83d1efe368ce490a4e2e9f3e881b0f94
BLAKE2b-256 687b93a1f76796c82b2e208586d95187ef7b20eda886b4189702978138cfccc0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.6.11-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 905eacc925654e6617ba73383338e0969b427fd6a052fdb0601220310f0f89b6
MD5 dc1df4eadaf25a04c2c3298e06451dd2
BLAKE2b-256 03e493597a88eeabe7fd551ad5bee1007139c0f1a1717a7255459fd61733290d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.6.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8c81a654555241d01530e4aecb0d82d45900d77a24f8bf08f3db5e6b78f09dd4
MD5 06d590375a4a3f969fdbea45b837bee7
BLAKE2b-256 7070891f0f4207156a4c3a2a3acc708d8d21b68d28fe55e12ba175099416ffba

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