GumTreeDiff / tree-sitter-parser

A tree generated based upon the amazing tree-sitter library.
GNU Affero General Public License v3.0
5 stars 6 forks source link

tree-sitter version must be bound in requirements.txt #14

Open mahtab-nejati opened 2 months ago

mahtab-nejati commented 2 months ago

I was trying this parser in a new environment where I installed tree-sitter==0.22.3 on MacOS, but I kept getting the following error:

Traceback (most recent call last):
  File "/.../tree-sitter-parser/tree-sitter-parser.py", line 55, in <module>
    main()
  File "/.../tree-sitter-parser/tree-sitter-parser.py", line 41, in main
    parsers = init_parsers(script_dir)
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/.../tree-sitter-parser/tree_sitter_parser/__init__.py", line 22, in init_parsers
    if Language.build_library(
       ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'tree_sitter.Language' has no attribute 'build_library'

My attempt in another environment with tree_sitter==0.20.1 was successful. It might be a good idea to bind the tree-sitter requirement to a specific version. You can see this discussion for more information.

mpadge commented 1 month ago

I'm setting the same error, with a few tree_sitter versions between 0.20.1 and 0.22.6, so it doesn't seem directly related to that.

jrfaller commented 1 month ago

Thanks for the report. It seems that this function was removed : https://github.com/tree-sitter/py-tree-sitter/pull/145#issuecomment-1969482456 😢

However, there does not seem to be any replacement... We might have to rethink how we integrate with the Python binding. In the meantime, you can try the Java binding (gen.treesitter-ng).

Cheers.