Project#
- class scubatrace.Project(path: str, language: type[Language], enable_lsp: bool = True)#
Bases:
objectA codebase project with a specified path and language.
- static create(path: str, language: type[Language], enable_lsp: bool = True) Project#
Factory function to create a language-specific
Projectinstance.- Parameters:
path (str) – The file system path to the project root.
language (type[Language]) – The programming language type for the project.
enable_lsp (bool, optional) – Whether to enable Language Server Protocol (LSP) support. Defaults to True. Note: For PHP and Swift, LSP is always disabled.
- Returns:
An instance of the appropriate language-specific Project subclass.
- Return type:
- Raises:
ValueError – If the provided language is not supported.
- export_callgraph(output_path: str)#
Exports the call graph of the project to a DOT file.
- Parameters:
output_path (str) – The directory where the call graph DOT file will be saved.
- property abspath: str#
The absolute path of the project.
- property callgraph: MultiDiGraph#
Call graph of the project, starting from the entry point function.
- property entry_point: Function | None#
The entry point function of the project, if it exists.
For example, in a C project, this would be the main function. If no entry point is defined, returns None.
- property files: dict[str, File]#
A dictionary mapping relative file paths to
Fileobjects for all source files in the project.The keys are relative paths from the project root, and the values are
Filerepresenting each source file.
- property files_abspath: dict[str, File]#
A dictionary mapping the absolute file paths to their corresponding
Fileobjects.
- property files_uri: dict[str, File]#
A dictionary mapping the file URIs to their corresponding
Fileobjects.
- path: str#
The file system path to the project root.
- property sub_dirs: list[str]#
A list of subdirectories in the project path.