-
Notifications
You must be signed in to change notification settings - Fork 4
Steps for updating dependency generation for new languages
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
The clean_dependencies
function is used to postprocess the dependency references generated by the module_locate module. Some of these steps will likely be relevant between languages such as removing duplicate dependencies. Others like removing submodules if a parent module is present will only be relevant for certain languages like Python. Additionally, there may need to be further steps added for other languages.