Skip to content
Merged
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
21 changes: 21 additions & 0 deletions chunk/src/ingest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from pathlib import Path

SKIP_DIRS = {"tests", ".git", "docs", "__pycache__"}


def load_python_files(root: Path):

for path in root.rglob("*.py"):
if any(part in SKIP_DIRS or part.endswith(".egg-info") for part in path.parts):
continue

try:
content = path.read_text(encoding="utf-8")
except UnicodeDecodeError:
print(f"Skipping (bad encoding): {path}")
continue

yield {
"path": str(path.relative_to(root)),
"content": content,
}