cunla / fakeredis-py

Implementation of Redis API in python without having a server running. Fully compatible with using redis-py.
https://fakeredis.moransoftware.ca/
BSD 3-Clause "New" or "Revised" License
300 stars 49 forks source link

Missing dependencies on latest pypi version: 1.7.6 #23

Closed JoseKilo closed 2 years ago

JoseKilo commented 2 years ago

Describe the bug

It looks like fakeredis still depends on six and sortedcontainers, but the dependencies were removed in this PR https://github.com/dsoftwareinc/fakeredis-py/pull/12 while migrating to poetry.

Before #12 :

install_requires =
    packaging
    redis<=4.3.1
    six>=1.12
    sortedcontainers

After #12 :

python = "^3.8"
lupa = "1.13"
redis = "4.3.1"
aioredis = "^2.0.1"

Current master:

[tool.poetry.dependencies]
python = "^3.8"
lupa = { version = "^1.13", optional = true }
redis = "<=4.3.1"
aioredis = { version = "^2.0.1", optional = true }

[tool.poetry.extras]
lua = ["lupa"]
aioredis = ["aioredis"]

I'm getting an error when I try to import using the latest version:

ImportError while loading conftest '/home/lyst/code/tests/conftest.py'.
tests/conftest.py:8: in <module>
    from fakeredis import FakeRedis
../venv/lib/python3.9/site-packages/fakeredis/__init__.py:1: in <module>
    from ._server import FakeServer, FakeRedis, FakeStrictRedis, FakeConnection   # noqa: F401
../venv/lib/python3.9/site-packages/fakeredis/_server.py:21: in <module>
    from ._zset import ZSet
../venv/lib/python3.9/site-packages/fakeredis/_zset.py:1: in <module>
    import sortedcontainers
E   ModuleNotFoundError: No module named 'sortedcontainers'

To Reproduce Steps to reproduce the behavior:

  1. Install version 1.7.6 on a clean environment
  2. Open a python shell
  3. import fakeredis
  4. See error:
(.venv) AA> python
Python 3.10.4 (main, Apr  9 2022, 21:27:52) [GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import fakeredis
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jose/workspace/lyst/braze-api/AA/.venv/lib/python3.10/site-packages/fakeredis/__init__.py", line 1, in <module>
    from ._server import FakeServer, FakeRedis, FakeStrictRedis, FakeConnection   # noqa: F401
  File "/home/jose/workspace/lyst/braze-api/AA/.venv/lib/python3.10/site-packages/fakeredis/_server.py", line 19, in <module>
    import six
ModuleNotFoundError: No module named 'six'

Expected behavior No import errors.

Screenshots N/A

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

cunla commented 2 years ago

Thanks for the fix, I'll publish it now and write a test for it later.