Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

fix bad git executable error via lazy importing gitpython #20

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions autollm/utils/git_utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import logging
from pathlib import Path

from git import Repo

logger = logging.getLogger(__name__)


Expand All @@ -14,6 +12,14 @@ def clone_or_pull_repository(git_url: str, local_path: Path) -> None:
git_url (str): The URL of the Git repository.
local_path (Path): The local path where the repository will be cloned or updated.
"""
# Lazy import to avoid dependency on GitPython
try:
from git import Repo
except ImportError:
logger.error(
'GitPython is not installed. Please "pip install gitpython==3.1.37" to use this feature.')
raise

if local_path.exists():
logger.info(f'Updating existing repository at {local_path}')
repo = Repo(str(local_path))
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
llama-index==0.8.46
litellm==0.8.4
gitpython==3.1.37
uvicorn==0.23.2
fastapi==0.103.2
python-dotenv
Expand Down