-
Notifications
You must be signed in to change notification settings - Fork 4
Steps for updating dependency generation for new languages
Vincent Raymond edited this page Mar 15, 2024
·
3 revisions
Modify the extract_imports
function to support extracting the names of imported modules for your language. For Python we use regex on the raw source code, but depending on the particular language you could also use Gromet or tree-sitter.
For example, the following would return ["time", "tree_sitter"]:
import time
from tree_sitter import Tree
Note that we are only returning the module name and not the object or function being imported. This is because module is currently the smallest unit of ingestion for Gromet.
Update module_locate
function to support locating the source for the modules. This task is more opened ended depending on your particular language. For Python we check:
- Python directory for built-in modules
- site-packages for installed modules
- pypi for all other module