kvesteri / sqlalchemy-continuum

Versioning extension for SQLAlchemy.
BSD 3-Clause "New" or "Revised" License
568 stars 128 forks source link

ModuleNotFoundError: No module named 'six' #324

Closed rik-coenders closed 1 year ago

rik-coenders commented 1 year ago

Using SQLAlchemy-Continuum==1.3.13 with SQLAlchemy==1.4.45 on python 3.11.1, I get the follwoing error:

/usr/local/lib/python3.11/site-packages/sqlalchemy_continuum/__init__.py:3: in <module>
    from .manager import VersioningManager
/usr/local/lib/python3.11/site-packages/sqlalchemy_continuum/manager.py:8: in <module>
    from .builder import Builder
/usr/local/lib/python3.11/site-packages/sqlalchemy_continuum/builder.py:8: in <module>
    from .dialects.postgresql import create_versioning_trigger_listeners
/usr/local/lib/python3.11/site-packages/sqlalchemy_continuum/dialects/postgresql.py:3: in <module>
    from sqlalchemy_continuum.plugins import PropertyModTrackerPlugin
/usr/local/lib/python3.11/site-packages/sqlalchemy_continuum/plugins/__init__.py:4: in <module>
    from .null_delete import NullDeletePlugin
/usr/local/lib/python3.11/site-packages/sqlalchemy_continuum/plugins/null_delete.py:2: in <module>
    from ..operation import Operation
/usr/local/lib/python3.11/site-packages/sqlalchemy_continuum/operation.py:7: in <module>
    import six
E   ModuleNotFoundError: No module named 'six'

This seems to come from operation.py having a depedency on six, but six is only added as a test requirement in setup.py.

The easy way would be to require six, but it would be nicer to remove the import from operation.py.

rik-coenders commented 1 year ago

I could create a PR for it depending on what is the desired solution.

If removing it from operations is fine, not much needs to be changed. It is only used in

def iteritems(self):
    return six.iteritems(self.objects)

I don't know if it is safe to remove iteritems altogether and only go for python 3 style items(). Otherwise iteritems could just use items which is only little less performant when using the already deprecated python 2.x

marksteward commented 1 year ago

Hi, I'll be removing six in the next version, but it's been added as a dependency for now via #327.