Not able to use hiredis with redis-py for server-assisted client-side caching
Version: redis-py - 5.1.0b7, hiredis - 3.0.0
Platform: Python 3.9 in MacBook Apple M3 Pro
Description: Trying server-assisted client-side caching with redis-py version 5.1.0b7, it worked fine without hredis. Tried with hiredis for additional performance, getting the following error once hiredis is installed and ran the script. Does it require any additional change, from this https://redis.io/docs/latest/develop/connect/clients/python/redis-py/ came to know no additional changes is required for most of the cases.
/Users/mahudees/PycharmProjects/redis-client/.venv/bin/python /Users/mahudees/PycharmProjects/rsacsc-py-master/pythoncsc/csc.py
Traceback (most recent call last):
File "/Users/mahudees/PycharmProjects/rsacsc-py-master/pythoncsc/csc.py", line 129, in
Process finished with exit code 1
#3324 hasn't release yet.
Thanks for the reply, when can we expect it to be released.
No one knows. For the time being, use hiredis<3.0.
Ok sure, Thank you.
https://github.com/redis/redis-py/pull/3324 was released but its still failing
hiredis 3.1.0
redis 5.2.1
Any update on this?
Is there a workaround for this? It still doesn't work.
$ pip list | grep redis
hiredis 3.1.0
redis 5.2.1
>>> import redis
>>> from redis.cache import CacheConfig
>>> r = redis.Redis(host='localhost', port=6379, protocol=3, cache_config=CacheConfig())
>>> r.set(b'foo', b'bar')
Traceback (most recent call last):
File "<python-input-3>", line 1, in <module>
r.set(b'foo', b'bar')
~~~~~^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/redis/commands/core.py", line 2335, in set
return self.execute_command("SET", *pieces, **options)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/redis/client.py", line 559, in execute_command
return self._execute_command(*args, **options)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/redis/client.py", line 565, in _execute_command
conn = self.connection or pool.get_connection(command_name, **options)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/redis/connection.py", line 1422, in get_connection
connection.connect()
~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/redis/connection.py", line 773, in connect
self._conn.connect()
~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/redis/connection.py", line 385, in connect
callback(self)
~~~~~~~~^^^^^^
File "/usr/local/lib/python3.13/site-packages/redis/connection.py", line 922, in _enable_tracking_callback
conn._parser.set_invalidation_push_handler(self._on_invalidation_callback)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: '_HiredisParser' object has no attribute 'set_invalidation_push_handler'
keep watching
Hello everyone!
This was fixed, and you can test it by using hiredis>=3.2.0 and redis-py from the master branch.
Let me know if you have any feedback or questions!
Fix is now available as part of https://github.com/redis/redis-py/releases/tag/v.6.2.0 release
@uglide As an aside, why was the release tag format changed from v6.1.0 to v.6.2.0 (extra dot)? I foresee that breaking systems...
@uglide As an aside, why was the release tag format changed from
v6.1.0tov.6.2.0(extra dot)? I foresee that breaking systems...
By mistake :( I'll check how this can be fixed...
@akx In which case it makes sense to pull a package from GitHub rather then using a package manager? This is the whole purpose of pip to provide a layer of abstraction from GitHub, so things can be decoupled. So changing naming schema is an issue, but I don't see how this should impact a lot of systems.
@akx In which case it makes sense to pull a package from GitHub rather then using a package manager?
Not necessarily the wheel itself, but, say, change logs for a given version, now that they are only tracked in Github releases.
@akx For those systems I agree, but not for production usage