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:
bb8-redis,

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"])

        # parse value as json
        print(await x.get("foo", encoding="json"))

        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.12.0.tar.gz (35.2 kB view details)

Uploaded Source

Built Distributions

redis_rs-0.12.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.3 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

redis_rs-0.12.0-cp312-none-win_amd64.whl (1.9 MB view details)

Uploaded CPython 3.12Windows x86-64

redis_rs-0.12.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

redis_rs-0.12.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (4.0 MB view details)

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

redis_rs-0.12.0-cp311-none-win_amd64.whl (1.9 MB view details)

Uploaded CPython 3.11Windows x86-64

redis_rs-0.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

redis_rs-0.12.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (4.0 MB view details)

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

redis_rs-0.12.0-cp310-none-win_amd64.whl (1.9 MB view details)

Uploaded CPython 3.10Windows x86-64

redis_rs-0.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

redis_rs-0.12.0-cp39-none-win_amd64.whl (1.9 MB view details)

Uploaded CPython 3.9Windows x86-64

redis_rs-0.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

redis_rs-0.12.0-cp38-none-win_amd64.whl (1.9 MB view details)

Uploaded CPython 3.8Windows x86-64

redis_rs-0.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

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

File metadata

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

File hashes

Hashes for redis_rs-0.12.0.tar.gz
Algorithm Hash digest
SHA256 2520bde4b01e7e8991fbefb48bce629dce64a205e7b8a91e3ef8ee72e6371794
MD5 ee96ab04be25675e16a03817defe4298
BLAKE2b-256 73844bde612d9fd75f154d26ac8c9987f3ec847bf377bdb1fcf4ac64aa8a2950

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.12.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d713a3f8fdd4ed42a48e36858fbc2c124907bb24ea28cc344e06b1cf9f3d8992
MD5 8162a770cf1334183bc6ea7ceb86a48b
BLAKE2b-256 0cbfe52bea49f553cfc07102aae7d0fc3c82412b9684887b595e6b840ac5672a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.12.0-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 19bf53ab9212157fbce94305d78f7d1bd441fa896cbe8ae11201080e191c8e9e
MD5 4d827c8dfb762e7bb0c2bfd4d8cdcdc6
BLAKE2b-256 f5599a1ab8737ca034c5660dcc14edf22d1babab71e32656454ddff1c2107725

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.12.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 343979b0f8890a07f7532f7e6c388fe8d917fbac64363ac43973eb16781228a6
MD5 e20ac99e6a00a1c60ae666d42c12df71
BLAKE2b-256 84171ace54fa3552cad1bc736480e58f9faa4f9dc92e8be5c64fd4db58bae93e

See more details on using hashes here.

File details

Details for the file redis_rs-0.12.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for redis_rs-0.12.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 8f5f6ec69e1ca02fc1936fbef14496eb2bfa2d7a0f95cd2de8f5483bc45dbbbe
MD5 32072c78a4dd7b25d11661c38b0a11c3
BLAKE2b-256 054e7b44b8e94c5fb931e8acf04fd5ed5fb6ba48e5dcfb539d35fe7f9b741b5c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.12.0-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 58b0ad125065eda30598616d9b3e34c0fa11daa8a590b82dc2493fe6f4f662bd
MD5 1e1799a3ce1ebc390c17bf497f57bd95
BLAKE2b-256 69df1f9111a36a0c42156bcf4c39955e75f2644b343ec895c2858dcf8d3da82c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 92fba65a2dc44cc0b4f184d0d684248091b3f374267a89d7bf1863b04826dd30
MD5 486c3ecc5ec7cdc46c914241478d7728
BLAKE2b-256 dbe88c99faf847b2c26bde3673eadc45757a9ee573fde6b3f2f5e2361dd471cd

See more details on using hashes here.

File details

Details for the file redis_rs-0.12.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for redis_rs-0.12.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 a3761ab59e9938dd1101816a9ab78aac02b9a0ff2cf315716af27de4992a03d1
MD5 f82889d1357c4a4843e908ca28de3996
BLAKE2b-256 def3cc4de962bb9f0b7144eb697d829cbd1ca91572c049315e8209478c560236

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.12.0-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 2483ca0638f525161edc5ef4182a169d8c95f72e8b09ffefd0874ebaa26bc505
MD5 45d4cf1494e1f29dce1be47ab3679944
BLAKE2b-256 79d2687ba42c9fe27827ea6b647cfa85918b54ce89a14ab8d19d41d1220fd5b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eafa7eb9172c9881aa0526ff1ba209a59b372d10a3689e548adb3a4bac902c2a
MD5 252172f6c01bfe1549dfbe0af134e258
BLAKE2b-256 4365f91f36493c17b0aa58177e4995f97ce4205fcc78b4ac99064765e01d20ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.12.0-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 a34663276475e5fce4ac562b1b63a2e660cc96e83fbe16234ed4f5346943f282
MD5 90dabf6aa0582fa1b8a88a3e582eacea
BLAKE2b-256 0d17c13df10067208f5071b049d22de6b2e3c4ea5cea3bf33c6cbb8e46ad0fe8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 01125eb9846417c8fa44f49b1b9c56bcd109beda874c6389ca59ed322204c562
MD5 4ada0e2da1af9a22e7c166b06d68a615
BLAKE2b-256 23f57f8be51e355e3cc4a508083e2337195b09600433c43b451fc203f1b59695

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.12.0-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 e7ec1e270259ed1755bcdc56685af02f96b61a990f28979da68b98e6800f3b1e
MD5 325d6071da668699123729de32edf317
BLAKE2b-256 e080b55b73e4600d5287b5bd9630c56eb61ca7411f22c295feb1722a39c8ad81

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_rs-0.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d6cebf16b71439dff3a4636e4ec48031291e3410473d9b7af09fa35cee291023
MD5 c2a88187bf5ff7bd41f8863bfc025bcd
BLAKE2b-256 7759932482052b6303699c289d80b5e362fc39ff07837c3604e5760a1ba213a7

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