IBM / codellm-devkit

codellm-devkit provides unified language to get off-the-shelf static analysis for multiple programming languages and support for applying those analyses for code LLM use cases.
https://ibm.github.io/codellm-devkit/
Apache License 2.0
18 stars 8 forks source link

importing tree-sitter #22

Closed lamwassi closed 2 days ago

lamwassi commented 2 weeks ago

Error

File "/codellm-devkit/cldk/analysis/java/treesitter/javasitter.py", line 3, in from tree_sitter import Language, Node, Parser, Query ImportError: cannot import name 'Language' from 'tree_sitter' (/codellm-devkit/tests/tree_sitter/init.py)

This error occurred while running tests/example.py

lamwassi commented 2 weeks ago

Renaming this folder :https://github.com/IBM/codellm-devkit/tree/main/tests/tree_sitter. to https://github.com/IBM/codellm-devkit/tree/main/tests/treesitter. resolves this issue. This issue is caused by the import order in python.

how to check

from typing import List, Set, Dict import tree_sitter print(dir(tree_sitter)) print(tree_sitter. file )

from tree_sitter import Language, Node, Parser, Query exit() This will show the correct path of the imported library