-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor project structure, enhance logic, update configurations, and…
… improve code quality Refactoring and Logic Improvements - Refactored the `_scan_directory` function in `src/gitingest/ingest_from_query.py` by extracting loop logic into the new `_process_item` function, and further separating functionality into `_process_symlink` and `_process_file` - Replaced multiple return statements with error raising and catching, introducing custom exceptions (`MaxFilesReachedError`, `MaxFileSizeReachedError`, `AlreadyVisitedError`) in the `_process_item` and `_scan_directory` functions - Enhanced the logic in the `process_query` function in `src/process_query.py` for better flow and maintainability - Improved the logic in `_generate_token_string` in `src/gitingest/ingest_from_query.py` - Refined the `download_ingest` function in `src/routers/download.py` for better clarity and functionality Exception Handling Enhancements - Replaced broad `Exception` handling with specific `OSError` in the `_read_file_content` function in `src/gitingest/ingest_from_query.py` - Refined exception handling throughout the codebase, including removing redundant try-except-raise blocks, e.g., in `clone_repo` function in `src/gitingest/clone.py` - Added custom exceptions to `src/gitingest/exceptions.py`: `MaxFilesReachedError`, `MaxFileSizeReachedError`, and `AlreadyVisitedError` - Included explicit re-raising of exceptions in various functions for improved error propagation Test Suite Refactoring - Cleaned up and reorganized test files: - Moved tests from `src/gitingest/tests/` to `tests/` - Consolidated fixtures from `tests/test_ingest.py` into `tests/conftest.py` - Removed redundant content from `tests/conftest.py` - Migrated configuration from `pytest.ini` to `pyproject.toml`, deleted `pytest.ini`, and updated `.dockerignore` Documentation Improvements - Added `darglint` for enforcing `numpy` docstring style in `.pre-commit-config.yaml` for `src/` files - Updated docstrings throughout the codebase, including adding module docstrings where needed - Updated `README.md`: - Added "GitHub stars" badge - Moved the "Discord" badge to its own line - Replaced occurrences of "Gitingest" with "GitIngest" for consistency and clarity Linting and Code Quality - Integrated `pylint` into `.pre-commit-config.yaml` for both `src/` and `tests/` directories - Created `tests/.pylintrc` for linting configuration specific to test files Code Clean-up - Removed the redundant `src/__init__.py` file Naming Conventions and Code Style - Renamed `logSliderToSize` to `log_slider_to_size` in `src/server_utils.py` for consistency with Python's naming conventions - Added explicit encoding specification in multiple instances of `open` throughout the code
- Loading branch information
1 parent
36b04a5
commit 61dbc8b
Showing
30 changed files
with
613 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,5 +37,4 @@ docs/ | |
tests/ | ||
*.md | ||
LICENSE | ||
pytest.ini | ||
setup.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,60 @@ | ||
[project] | ||
name = "gitingest" | ||
version = "0.1.2" | ||
description="CLI tool to analyze and create text dumps of codebases for LLMs" | ||
readme = {file = "README.md", content-type = "text/markdown" } | ||
requires-python = ">= 3.10" | ||
dependencies = [ | ||
"click>=8.0.0", | ||
"fastapi-analytics", | ||
"fastapi[standard]", | ||
"python-dotenv", | ||
"slowapi", | ||
"starlette", | ||
"tiktoken", | ||
"uvicorn", | ||
] | ||
license = {file = "LICENSE"} | ||
authors = [{name = "Romain Courtois", email = "[email protected]"}] | ||
classifiers=[ | ||
"Development Status :: 3 - Alpha", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Programming Language :: Python :: 3.13", | ||
] | ||
|
||
[project.scripts] | ||
gitingest = "gitingest.cli:main" | ||
|
||
[project.urls] | ||
homepage = "https://gitingest.com" | ||
github = "https://github.com/cyclotruc/gitingest" | ||
|
||
[build-system] | ||
requires = ["setuptools>=61.0", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools] | ||
packages = {find = {where = ["src"]}} | ||
include-package-data = true | ||
|
||
# Linting configuration | ||
[tool.pylint.format] | ||
max-line-length = 119 | ||
|
||
[tool.pylint.'MESSAGES CONTROL'] | ||
disable = [ | ||
"too-many-arguments", | ||
"too-many-positional-arguments", | ||
"too-many-locals", | ||
"too-few-public-methods", | ||
"broad-exception-caught", | ||
"duplicate-code", | ||
] | ||
|
||
[tool.pycln] | ||
all = true | ||
|
||
|
@@ -14,3 +68,12 @@ filter_files = true | |
|
||
[tool.black] | ||
line-length = 119 | ||
|
||
# Test configuration | ||
[tool.pytest.ini_options] | ||
pythonpath = ["src"] | ||
testpaths = ["tests/"] | ||
python_files = "test_*.py" | ||
asyncio_mode = "auto" | ||
python_classes = "Test*" | ||
python_functions = "test_*" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
""" Default ignore patterns for GitIngest. """ | ||
|
||
DEFAULT_IGNORE_PATTERNS: list[str] = [ | ||
# Python | ||
"*.pyc", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.