neogeny / TatSu

竜 TatSu generates Python parsers from grammars in a variation of EBNF

Home Page:https://tatsu.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python version support inconsistency

dimapu opened this issue · comments

Hi,

Thanks for developing and supporting this powerful package.

I noticed that with the new release 5.7.0, pip install tatsu in python 3.8 installs this version which leads to an error (see in the end). For python 3.7 and 3.9 a proper version is chosen and installed by pip.

Specifically,

  • in python 3.7, it installs version 4.4.0 (this is as expected, this is the last version supporting 3.7)
  • in python 3.8, it installs version 5.7.0 (not expected and leads to error messages when importing tatsu. 5.6.1 is the last one to support python 3.8)
  • in python 3.9, it installs version 5.7.0 (as expected, no errors)

I see that although 5.7.0 specifies python_requires = >=3.9 in setup.cfg, this is for some reason ignored by pip in python 3.8. In contrast, the line python_requires='>=3.8', in setup.py version 5.5.0 obviously has an effect and does not allow installing it in python 3.7.

As a side note, 5.7.0 has a small inconsistency in setup.cfg:

...
    Programming Language :: Python :: 3.10
    Programming Language :: Python :: 3.11
...
python_requires = >=3.9

Shall Programming Language :: Python :: 3.9 be mentioned too? Or shall requirement be python_requires = >3.9?

Thanks ahead and best regards,
Dima.

Error message:

Python 3.8.10 (default, May 19 2021, 13:12:57) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tatsu
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\PF\Ana3\envs\test\lib\site-packages\tatsu\__init__.py", line 5, in <module>
    from tatsu.tool import (  # pylint: disable=W0622
  File "C:\PF\Ana3\envs\test\lib\site-packages\tatsu\tool.py", line 15, in <module>
    from tatsu.parser import GrammarGenerator
  File "C:\PF\Ana3\envs\test\lib\site-packages\tatsu\parser.py", line 4, in <module>
    from tatsu.semantics import ASTSemantics
  File "C:\PF\Ana3\envs\test\lib\site-packages\tatsu\semantics.py", line 6, in <module>
    from tatsu.objectmodel import Node
  File "C:\PF\Ana3\envs\test\lib\site-packages\tatsu\objectmodel.py", line 4, in <module>
    from functools import cache
ImportError: cannot import name 'cache' from 'functools' (C:\PF\Ana3\envs\test\lib\functools.py)

This should be dealt with in the just published v5.7.1.

Thanks for the quick fix. Python3.7, 3.8, and 3.9 now pull the proper versions from the pip. (And the code actually runs correct for me.)

Cheers,
Dima.

This version in the setup.cfg (on the 5.7.1 tag) is wrong, though:

version = 5.7.0