python-redis
Port variant py310
Summary Redis database and key-value store client (3.10)
Package version 5.0.0
Homepage https://github.com/redis/redis-py
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v11
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 15 AUG 2023, 17:14:27 UTC
Port created 28 AUG 2018, 14:25:25 UTC
Subpackage Descriptions
single # redis-py The Python interface to the Redis key-value store. [CI] [docs] [MIT licensed] [pypi] [![pre-release]](https://github.com/redis/redis-py/releases) [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+. --------------------------------------------- ## Installation Start a redis via docker: ``` bash docker run -p 6379:6379 -it redis/redis-stack:latest ``` To install redis-py, simply: ``` bash $ 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. ``` bash $ 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], and [7.0]. 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 | ## Usage ### Basic Example ``` python >>> import redis >>> r = redis.Redis(host='localhost', port=6379, db=0) >>> r.set('foo', 'bar') True >>> r.get('foo') b'bar' ``` 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* ``` python >>> 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]. ``` python >>> 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
Configuration Switches (platform-specific settings discarded)
PY310 ON Build using Python 3.10 PY311 OFF Build using Python 3.11
Package Dependencies by Type
Build (only) python-pip:single:py310
autoselect-python:single:standard
Build and Runtime python310:single:standard
Runtime (only) python-async-timeout:single:py310
Download groups
main mirror://PYPIWHL/df/b2/dfdc17f701f7b587f6c89c2b9b6b5978c87a8a785555efc810b064c875de
Distribution File Information
06570d0b2d84d46c21defc550afbaada381af82f5b83e5b3777600e05d8e2ed0 250068 redis-5.0.0-py3-none-any.whl
Ports that require python-redis:py310
python-django-redis:py310 Redis cache backend for Django (3.10)
python-django-rq:py310 Django integration of Redis Queue (3.10)
python-rq:py310 Library for procesing background jobs (3.10)