Skip to content

Unwanted dependency on Redis and SQLAlchemy #1330

Closed
@scranen

Description

@scranen

It seems that this PR, intended to improve documentation, had the side effect of making it impossible to import anything from the datastore package unless you have Redis and SQLAlchemy installed.

Versions

  • Python: any
  • OS: any
  • Pymodbus: 3.1.2
  • Modbus Hardware (if used): n/a

Pymodbus Specific

  • Server: tcp/rtu/ascii - sync/async
  • Client: tcp/rtu/ascii - sync/async

Description

I'm trying to import some classes from the datastore package to set up a mock. This worked before, but with the latest release of PyModbus this results in an error.

Code and Logs

from pymodbus.datastore import (
    ModbusSlaveContext, 
    ModbusServerContext,
    ModbusSparseDataBlock
)

Results in:

Traceback (most recent call last):
  File "/Users/scranen/Repos/fca/devices/test/mock_ptl_controller.py", line 6, in <module>
    from pymodbus.datastore import (
  File "/Users/scranen/.local/share/virtualenvs/devices-2hMeqm5U/lib/python3.10/site-packages/pymodbus/datastore/__init__.py", line 3, in <module>
    from pymodbus.datastore.database.redis_datastore import RedisSlaveContext
  File "/Users/scranen/.local/share/virtualenvs/devices-2hMeqm5U/lib/python3.10/site-packages/pymodbus/datastore/database/__init__.py", line 2, in <module>
    from pymodbus.datastore.database.redis_datastore import RedisSlaveContext
  File "/Users/scranen/.local/share/virtualenvs/devices-2hMeqm5U/lib/python3.10/site-packages/pymodbus/datastore/database/redis_datastore.py", line 5, in <module>
    import redis
ModuleNotFoundError: No module named 'redis'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions