Skip to content

Commit dc98342

Browse files
Refactor codebase into core and server subpackages
- Moved shared logic (config, exceptions, ignore_patterns, etc.) into `core/`. - Created `server/` to host FastAPI modules, static files, and templates. - Updated import paths for CLI and tests to reference `core.*` and `server.*`. - Changed static references from `"/static"` to `"/server/static"` and templates from `"/templates"` to `"/server/templates"`. - Adjusted references in `base.jinja`, `server/main.py`, `server/query_processor.py`, and routers to reflect the new server paths. - Ensured Docker builds now correctly serve static and template files from `server/`.
1 parent 71b1167 commit dc98342

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+98
-101
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ USER appuser
4141

4242
EXPOSE 8000
4343

44-
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
44+
CMD ["python", "-m", "uvicorn", "server.main:app", "--host", "0.0.0.0", "--port", "8000"]

src/core/__init__.py

Whitespace-only changes.
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pathlib import Path
77
from typing import Any
88

9-
from gitingest.exceptions import InvalidNotebookError
9+
from core.exceptions import InvalidNotebookError
1010

1111

1212
def process_notebook(file: Path, include_output: bool = True) -> str:
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,10 @@
66

77
import tiktoken
88

9-
from config import MAX_DIRECTORY_DEPTH, MAX_FILES, MAX_TOTAL_SIZE_BYTES
10-
from gitingest.exceptions import (
11-
AlreadyVisitedError,
12-
InvalidNotebookError,
13-
MaxFileSizeReachedError,
14-
MaxFilesReachedError,
15-
)
16-
from gitingest.notebook_utils import process_notebook
17-
from gitingest.query_parser import ParsedQuery
9+
from core.config import MAX_DIRECTORY_DEPTH, MAX_FILES, MAX_TOTAL_SIZE_BYTES
10+
from core.exceptions import AlreadyVisitedError, InvalidNotebookError, MaxFileSizeReachedError, MaxFilesReachedError
11+
from core.notebook_utils import process_notebook
12+
from core.query_parser import ParsedQuery
1813

1914

2015
def _should_include(path: Path, base_path: Path, include_patterns: set[str]) -> bool:
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
from pathlib import Path
1010
from urllib.parse import unquote, urlparse
1111

12-
from config import MAX_FILE_SIZE, TMP_BASE_PATH
13-
from gitingest.exceptions import InvalidPatternError
14-
from gitingest.ignore_patterns import DEFAULT_IGNORE_PATTERNS
15-
from gitingest.repository_clone import _check_repo_exists, fetch_remote_branch_list
12+
from core.config import MAX_FILE_SIZE, TMP_BASE_PATH
13+
from core.exceptions import InvalidPatternError
14+
from core.ignore_patterns import DEFAULT_IGNORE_PATTERNS
15+
from core.repository_clone import _check_repo_exists, fetch_remote_branch_list
1616

1717
HEX_DIGITS: set[str] = set(string.hexdigits)
1818

@@ -227,7 +227,7 @@ async def _configure_branch_and_subpath(remaining_parts: list[str], url: str) ->
227227
# Fetch the list of branches from the remote repository
228228
branches: list[str] = await fetch_remote_branch_list(url)
229229
except RuntimeError as e:
230-
warnings.warn(f"Warning: Failed to fetch branch list: {e}")
230+
warnings.warn(f"Warning: Failed to fetch branch list: {e}", UserWarning)
231231
return remaining_parts.pop(0)
232232

233233
branch = []
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import asyncio
44
from dataclasses import dataclass
55

6-
from gitingest.utils import async_timeout
6+
from core.utils import async_timeout
77

88
TIMEOUT: int = 20
99

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import inspect
55
import shutil
66

7-
from config import TMP_BASE_PATH
8-
from gitingest.query_ingestion import run_ingest_query
9-
from gitingest.query_parser import ParsedQuery, parse_query
10-
from gitingest.repository_clone import CloneConfig, clone_repo
7+
from core.config import TMP_BASE_PATH
8+
from core.query_ingestion import run_ingest_query
9+
from core.query_parser import ParsedQuery, parse_query
10+
from core.repository_clone import CloneConfig, clone_repo
1111

1212

1313
async def ingest(

0 commit comments

Comments
 (0)