experimental/cuda-ubi9/: redis-5.0.4 metadata and description

Homepage Simple index

Python client for Redis database and key-value store

author Redis Inc.
author_email oss@redis.com
  • Development Status :: 5 - Production/Stable
  • Environment :: Console
  • Intended Audience :: Developers
  • License :: OSI Approved :: MIT License
  • Operating System :: OS Independent
  • Programming Language :: Python
  • Programming Language :: Python :: 3
  • Programming Language :: Python :: 3 :: Only
  • Programming Language :: Python :: 3.7
  • Programming Language :: Python :: 3.8
  • Programming Language :: Python :: 3.9
  • Programming Language :: Python :: 3.10
  • Programming Language :: Python :: 3.11
  • Programming Language :: Python :: Implementation :: CPython
  • Programming Language :: Python :: Implementation :: PyPy
description_content_type text/markdown
keywords Redis,key-value store,database
license MIT
  • Documentation, https://redis.readthedocs.io/en/latest/
  • Changes, https://github.com/redis/redis-py/releases
  • Code, https://github.com/redis/redis-py
  • Issue tracker, https://github.com/redis/redis-py/issues
provides_extras ocsp
  • async-timeout >=4.0.3 ; python_full_version < "3.11.3"
  • importlib-metadata >=1.0 ; python_version < "3.8"
  • typing-extensions ; python_version < "3.8"
  • hiredis >=1.0.0 ; extra == 'hiredis'
  • cryptography >=36.0.1 ; extra == 'ocsp'
  • pyopenssl ==20.0.1 ; extra == 'ocsp'
  • requests >=2.26.0 ; extra == 'ocsp'
requires_python >=3.7
File Tox results History
246 KB
Python Wheel


The Python interface to the Redis key-value store.

CI docs MIT licensed pypi pre-release codecov

Installation | Usage | Advanced Topics | Contributing

**Note: ** redis-py 5.0 will be the last version of redis-py to support Python 3.7, as it has reached end of life. redis-py 5.1 will support Python 3.8+.

How do I Redis?

Learn for free at Redis University

Build faster with the Redis Launchpad

Try the Redis Cloud

Dive in developer tutorials

Join the Redis community

Work at Redis


Start a redis via docker:

docker run -p 6379:6379 -it redis/redis-stack:latest

To install redis-py, simply:

$ pip install redis

For faster performance, install redis with hiredis support, this provides a compiled response parser, and for most cases requires zero code changes. By default, if hiredis >= 1.0 is available, redis-py will attempt to use it for response parsing.

$ pip install "redis[hiredis]"

Looking for a high-level library to handle object mapping? See redis-om-python!

Supported Redis Versions

The most recent version of this library supports redis version 5.0, 6.0, 6.2, 7.0 and 7.2.

The table below highlights version compatibility of the most-recent library versions and redis versions.

Library version Supported redis versions
3.5.3 <= 6.2 Family of releases
>= 4.5.0 Version 5.0 to 7.0
>= 5.0.0 Version 5.0 to current


Basic Example

>>> import redis
>>> r = redis.Redis(host='localhost', port=6379, db=0)
>>> r.set('foo', 'bar')
>>> r.get('foo')

The above code connects to localhost on port 6379, sets a value in Redis, and retrieves it. All responses are returned as bytes in Python, to receive decoded strings, set decode_responses=True. For this, and more connection options, see these examples.

RESP3 Support

To enable support for RESP3, ensure you have at least version 5.0 of the client, and change your connection object to include protocol=3

>>> import redis
>>> r = redis.Redis(host='localhost', port=6379, db=0, protocol=3)

Connection Pools

By default, redis-py uses a connection pool to manage connections. Each instance of a Redis class receives its own connection pool. You can however define your own redis.ConnectionPool.

>>> pool = redis.ConnectionPool(host='localhost', port=6379, db=0)
>>> r = redis.Redis(connection_pool=pool)

Alternatively, you might want to look at Async connections, or Cluster connections, or even Async Cluster connections.

Redis Commands

There is built-in support for all of the out-of-the-box Redis commands. They are exposed using the raw Redis command names (HSET, HGETALL, etc.) except where a word (i.e. del) is reserved by the language. The complete set of commands can be found here, or the documentation.

Advanced Topics

The official Redis command documentation does a great job of explaining each command in detail. redis-py attempts to adhere to the official command syntax. There are a few exceptions:

For more details, please see the documentation on advanced topics page.


The following is a basic example of a Redis pipeline, a method to optimize round-trip calls, by batching Redis commands, and receiving their results as a list.

>>> pipe = r.pipeline()
>>> pipe.set('foo', 5)
>>> pipe.set('bar', 18.5)
>>> pipe.set('blee', "hello world!")
>>> pipe.execute()
[True, True, True]


The following example shows how to utilize Redis Pub/Sub to subscribe to specific channels.

>>> r = redis.Redis(...)
>>> p = r.pubsub()
>>> p.subscribe('my-first-channel', 'my-second-channel', ...)
>>> p.get_message()
{'pattern': None, 'type': 'subscribe', 'channel': b'my-second-channel', 'data': 1}


redis-py is developed and maintained by Redis Inc. It can be found here, or downloaded from pypi.

Special thanks to: