theopenconversationkit / tock-py

Tock client to build conversational stories using Python.
https://doc.tock.ai
MIT License
4 stars 6 forks source link

Compatibility problem with python 3.6 #27

Open Aluriak opened 3 years ago

Aluriak commented 3 years ago

According to the packaging information, supported Python version go down to 3.6, as per official doc.

However, running it with 3.6 will raise a SyntaxError :

 ❯ python3 -m tock      Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.6/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.6/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/home/lucas/Documents/littles/tock-py/tock/__init__.py", line 1, in <module>
    from tock.bot import TockBot
  File "/home/lucas/Documents/littles/tock-py/tock/bot.py", line 22, in <module>
    from tock.bus import TockBotBus, BotBus
  File "/home/lucas/Documents/littles/tock-py/tock/bus.py", line 6, in <module>
    from tock.session.session import Session
  File "/home/lucas/Documents/littles/tock-py/tock/session/session.py", line 6, in <module>
    from tock.models import Entity, UserId
  File "/home/lucas/Documents/littles/tock-py/tock/models.py", line 2
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined

This is due to the annotation system, introduced in 3.7.

Since i'm using 3.6 for a long moment, i would advocate to follow the official release cycle and make the code compatible with python 3.6. I can make the PR if you decide to follow that path.

elebescond commented 3 years ago

indeed the code does not work in 3.6. End of support is 2021-12-23 ...

If supporting version 3.6 is easy for you can do ... But how to do with the existing and the annotations?

Aluriak commented 3 years ago

Supporting 3.6 will need some of the current annotations to be removed, notably methods returning instances of the object they belong to.

So unless you are using some annotation interpreting system, this won't degrade any functionality, and i would recommend supporting more python versions instead of using the currently still evolving API for a non-used static typing.

For curiosity, which tool do you use to make sense of annotations ?