ChenghaoMou/text-dedup

Python 3.9 compatibility

ZJaume opened this issue · 2 comments

ZJaume commented

Is Python 3.9 going to be supported? When I try to install from source with a lower Python version it says it only supports Python <3.12 >=3.9. But then, installing it and running with Python 3.9 it seems that there are some idioms that are from higher versions and the interface crashes like:

python -m text_dedup.simhash -h
Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 188, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.9/runpy.py", line 158, in _get_module_details
    code = loader.get_code(mod_name)
  File "<frozen importlib._bootstrap_external>", line 988, in get_code
  File "<frozen importlib._bootstrap_external>", line 918, in source_to_code
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/work/user/text-dedup/text_dedup/minhash.py", line 170
    match args.hash_func:
          ^
SyntaxError: invalid syntax
python -m text_dedup.minhash -h
Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/work/user/text-dedup/text_dedup/minhash.py", line 34, in <module>
    from text_dedup.utils.analysis import optimal_param
  File "/work/user/text-dedup/text_dedup/utils/analysis.py", line 13, in <module>
    doc1: str | List[str],
TypeError: unsupported operand type(s) for |: 'type' and '_GenericAlias'

It would be helpful to have the option to run at least with python 3.9 or even 3.8. 3.10 is still too new and it's not available in some environments and sometimes the user does not have a choice.

Thanks for pointing this out; I have updated the requirements. Unfortunately, Python 3.9 or lower will not be supported at this moment due to limited bandwidth. However, feel free to fork the repo and change the syntax to your needs or use a virtual Python environment.

ZJaume commented

Alright, thanks!