From 922cfea381b5ce4eaf4bd93435611802c528af12 Mon Sep 17 00:00:00 2001 From: Roi Lipman Date: Thu, 14 Nov 2024 13:30:34 +0200 Subject: [PATCH] lazy load git module --- code_graph/project.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code_graph/project.py b/code_graph/project.py index fab63c5..d789df1 100644 --- a/code_graph/project.py +++ b/code_graph/project.py @@ -3,7 +3,6 @@ import logging import validators import subprocess -from git import Repo from .info import * from pathlib import Path from .graph import Graph @@ -61,6 +60,7 @@ def from_git_repository(cls, url: str): @classmethod def from_local_repository(cls, path: Path|str): + from git import Repo path = Path(path) if isinstance(path, str) else path # Validate path exists @@ -77,6 +77,7 @@ def from_local_repository(cls, path: Path|str): return cls(name, path, url) def analyze_sources(self, ignore: Optional[List[str]] = []) -> Graph: + from git import Repo analyzer = SourceAnalyzer() analyzer.analyze(self.path, self.graph, ignore)