Attumm / redis-dict

Python dictionary with Redis as backend, built for large datasets. Simplifies Redis operations for large-scale and distributed systems. Supports various data types, namespacing, pipelining, and expiration.
https://attumm.github.io/redis-dict/
MIT License
53 stars 14 forks source link

import fails for version v2.4 in python 3.9 #44

Closed Girgitt closed 8 months ago

Girgitt commented 9 months ago

In version v.2.4 (tested tags v.2.4.0 and v.2.4.1) RedisDict cannot be imported under python 3.9 due to syntax error:

    from redis_dict import RedisDict
  File "/home/zbig/repos/bess/modbus_rest_proxy/venv_linux_py39/lib/python3.9/site-packages/redis_dict.py", line 79, in <module>
    class RedisDict:
  File "/home/zbig/repos/bess/modbus_rest_proxy/venv_linux_py39/lib/python3.9/site-packages/redis_dict.py", line 643, in RedisDict
    def expire_at(self, sec_epoch: int | timedelta) -> Iterator[None]:
TypeError: unsupported operand type(s) for |: 'type' and 'type'

redis_dict.py: 642-3

    @contextmanager
    def expire_at(self, sec_epoch: int | timedelta) -> Iterator[None]:

Writing union types as int | timedelta is not supported in python 3.9

Tag v.2.3 works fine.

Attumm commented 9 months ago

Thanks for bringing the issue to my attention. It's time to create a testing pipeline for different Python versions, With GitHub CI so it won't happen again.

Please check out the latest version, v2.5.0; the issue should be resolved :)

Attumm commented 9 months ago

@Girgitt Did you get a chance to check if the issue still persists with the latest version?