bitranox/lib_shopware6_api_base

library uses 'attrs' module without minimum version but in fact requires >= 21.3

laf0rge opened this issue · 2 comments

I'm on Debian unstabel and have just installed the lib_shopware6_api_base via pip. pip did not install the attrs module from pypl/pip, as it is already provided by the operating system:

ii  python3-attr                                                21.2.0-1                                     all          Attributes without boilerplate (Python 3)

However:

$ ./shopware_api_test.py
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/lib_shopware6_api_base/lib_shopware6_api_base.py", line 19, in 
    from conf_shopware6_api_base_classes import *
ModuleNotFoundError: No module named 'conf_shopware6_api_base_classes'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/crypt/home_laforge_crypt/projects/kommerz/sysmocom/shopware/api/./shopware_api_test.py", line 3, in 
    from lib_shopware6_api_base import Shopware6AdminAPIClientBase
  File "/usr/local/lib/python3.10/dist-packages/lib_shopware6_api_base/__init__.py", line 9, in 
    from .lib_shopware6_api_base import *
  File "/usr/local/lib/python3.10/dist-packages/lib_shopware6_api_base/lib_shopware6_api_base.py", line 23, in 
    from .conf_shopware6_api_base_classes import *  # type: ignore  # pragma: no cover
  File "/usr/local/lib/python3.10/dist-packages/lib_shopware6_api_base/conf_shopware6_api_base_classes.py", line 7, in 
    import attrs
ModuleNotFoundError: No module named 'attrs'

some more research showed that attrs.validators was only introduced in attrs 21.3.0 in the following commit:

commit e7345584ffb8de9016e2ccf736e702d0289b0401
Author: Hynek Schlawack 
Date:   Sat Dec 25 15:15:10 2021 +0100

    Add attrs namespace (#887)

diff --git a/src/attrs/validators.py b/src/attrs/validators.py
new file mode 100644
index 0000000..ad46fbb
--- /dev/null
+++ b/src/attrs/validators.py
@@ -0,0 +1 @@
+from attr.validators import *  # noqa

and

$  git tag --contains e7345584ffb8de9016e2ccf736e702d0289b0401
21.3.0
21.4.0
21.4.0.post1

So any attrs prior 21.3.0 will have attr.validators and not attrs.validators.

You could either explicitly require versions >= 21.3.0 or simply change from attrs.validators to attr.validators.

thanks for Your professional report.
I will explicitly require versions >= 21.3.0 because attrs is the newer namespace and interface, with some additional goodies.
yours sincerely
Robert

solved with b905d60 and released.