Skip to content

Commit b2e0825

Browse files
chore: migrate to Ruff, deprecate .gitingest, and general code-quality sweep
* Pre-commit • Drop `black` + `darglint` hooks • Add `ruff-check` & `ruff-format` (astral-sh/ruff-pre-commit) • Swap `darglint` → `pydoclint` for doc-string lint/validation * Dependencies • Remove `tomli` • Tighten `typing_extensions` pin; add `eval-type-backport` • `requirements-dev`: drop `black`, `djlint`, `pylint` (only used inside pre-commit virtualenv) * Ignore handling • Deprecate `.gitingest` (TOML) → new `.gitingestignore` with git-wildmatch syntax • Delete `apply_gitingest_file`; reuse `_parse_ignore_file` shared with `.gitignore` * Tooling / config • New `[tool.ruff]` section in `pyproject.toml` • Remove `[tool.black]` * README • Refresh badges (PyPI, CI, Ruff, Discord, Trendshift) * Codebase refactor • Enable `from __future__ import annotations`; add rich type hints throughout • Re-order function parameters and `__all__` exports for consistency • Move type-only imports under `if TYPE_CHECKING` • Extract CLI args to `TypedDict` `_CLIArgs`; form data to pydantic `QueryForm` • Deduplicate `cli.main` / `_async_main` • Split large blocks into helpers • Remove magic numbers → constants • Use `pathlib` over `os`; avoid `try/except` inside loops; no file-IO in async paths • Enforce kw-only args • Minor Ruff-driven clean-ups * Bug fix • Remove silent logic bug in `notebook_utils._process_cell` * Tests • Update fixtures & assertions No functional API changes except the `.gitingestignore` addition & `.gitingest` deprecation.
1 parent c2ad390 commit b2e0825

Some content is hidden

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

52 files changed

+1590
-1304
lines changed

.pre-commit-config.yaml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ repos:
3838
- id: absolufy-imports
3939
description: "Automatically convert relative imports to absolute. (Use `args: [--never]` to revert.)"
4040

41-
- repo: https://github.com/psf/black
42-
rev: 25.1.0
43-
hooks:
44-
- id: black
45-
4641
- repo: https://github.com/asottile/pyupgrade
4742
rev: v3.20.0
4843
hooks:
@@ -79,12 +74,18 @@ repos:
7974
description: "Lint markdown files."
8075
args: ["--disable=line-length"]
8176

82-
- repo: https://github.com/terrencepreilly/darglint
83-
rev: v1.8.1
77+
- repo: https://github.com/astral-sh/ruff-pre-commit
78+
rev: v0.12.0
79+
hooks:
80+
- id: ruff-check
81+
- id: ruff-format
82+
83+
- repo: https://github.com/jsh9/pydoclint
84+
rev: 0.6.7
8485
hooks:
85-
- id: darglint
86-
name: darglint for source
87-
args: [--docstring-style=numpy]
86+
- id: pydoclint
87+
name: pydoclint for source
88+
args: [--style=numpy]
8889
files: ^src/
8990

9091
- repo: https://github.com/pycqa/pylint
@@ -104,7 +105,6 @@ repos:
104105
slowapi,
105106
starlette>=0.40.0,
106107
tiktoken,
107-
tomli,
108108
pathspec,
109109
uvicorn>=0.11.7,
110110
]
@@ -124,7 +124,6 @@ repos:
124124
slowapi,
125125
starlette>=0.40.0,
126126
tiktoken,
127-
tomli,
128127
pathspec,
129128
uvicorn>=0.11.7,
130129
]

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# Gitingest
22

3-
[![Image](./docs/frontpage.png "Gitingest main page")](https://gitingest.com)
3+
[![Gitingest banner](./docs/frontpage.png)](https://gitingest.com)
44

5-
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/cyclotruc/gitingest/blob/main/LICENSE)
6-
[![PyPI version](https://badge.fury.io/py/gitingest.svg)](https://badge.fury.io/py/gitingest)
7-
[![GitHub stars](https://img.shields.io/github/stars/cyclotruc/gitingest?style=social.svg)](https://github.com/cyclotruc/gitingest)
5+
[![PyPI](https://img.shields.io/pypi/v/gitingest.svg)](https://pypi.org/project/gitingest)
86
[![Downloads](https://pepy.tech/badge/gitingest)](https://pepy.tech/project/gitingest)
7+
[![CI](https://github.com/cyclotruc/gitingest/workflows/CI/badge.svg)](https://github.com/cyclotruc/gitingest/actions)
8+
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
9+
[![License](https://img.shields.io/github/license/cyclotruc/gitingest.svg)](https://github.com/cyclotruc/gitingest/blob/main/LICENSE)
10+
[![GitHub stars](https://img.shields.io/github/stars/cyclotruc/gitingest?style=social.svg)](https://github.com/cyclotruc/gitingest)
11+
[![Discord](https://img.shields.io/badge/Discord-Join_chat-%235865F2?logo=discord&logoColor=white)](https://discord.com/invite/zerRaGK9EC)
912

10-
[![Discord](https://dcbadge.limes.pink/api/server/https://discord.com/invite/zerRaGK9EC)](https://discord.com/invite/zerRaGK9EC)
13+
[![Trendshift badge](https://trendshift.io/api/badge/repositories/13519)](https://trendshift.io/repositories/13519)
1114

1215
Turn any Git repository into a prompt-friendly text ingest for LLMs.
1316

pyproject.toml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ dependencies = [
1212
"slowapi",
1313
"starlette>=0.40.0", # Vulnerable to https://osv.dev/vulnerability/GHSA-f96h-pmfr-66vw
1414
"tiktoken>=0.7.0", # Support for o200k_base encoding
15-
"tomli",
1615
"pathspec>=0.12.1",
17-
"typing_extensions; python_version < '3.10'",
16+
"typing_extensions>= 4.0.0; python_version < '3.10'",
1817
"uvicorn>=0.11.7", # Vulnerable to https://osv.dev/vulnerability/PYSEC-2020-150
1918
]
2019

@@ -62,20 +61,46 @@ disable = [
6261
"fixme",
6362
]
6463

64+
[tool.ruff]
65+
line-length = 119
66+
fix = true
67+
68+
[tool.ruff.lint]
69+
select = ["ALL"]
70+
ignore = [ # https://docs.astral.sh/ruff/rules/...
71+
"D107", # undocumented-public-init
72+
"FIX002", # line-contains-todo
73+
"TD002", # missing-todo-author
74+
"PLR0913", # too-many-arguments,
75+
76+
# TODO: fix the following issues:
77+
"TD003", # missing-todo-link, TODO: add issue links
78+
"T201", # print, TODO: replace with logging
79+
"S108", # hardcoded-temp-file, TODO: replace with tempfile
80+
"BLE001", # blind-except, TODO: replace with specific exceptions
81+
"FAST003", # fast-api-unused-path-parameter, TODO: fix
82+
]
83+
per-file-ignores = { "tests/**/*.py" = ["S101"] } # Skip the “assert used” warning
84+
85+
[tool.ruff.lint.pylint]
86+
max-returns = 10
87+
88+
[tool.ruff.lint.isort]
89+
order-by-type = true
90+
case-sensitive = true
91+
6592
[tool.pycln]
6693
all = true
6794

95+
# TODO: Remove this once we figure out how to use ruff-isort
6896
[tool.isort]
6997
profile = "black"
7098
line_length = 119
7199
remove_redundant_aliases = true
72-
float_to_top = true
100+
float_to_top = true # https://github.com/astral-sh/ruff/issues/6514
73101
order_by_type = true
74102
filter_files = true
75103

76-
[tool.black]
77-
line-length = 119
78-
79104
# Test configuration
80105
[tool.pytest.ini_options]
81106
pythonpath = ["src"]

requirements-dev.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
-r requirements.txt
2-
black
3-
djlint
2+
eval-type-backport
43
pre-commit
5-
pylint
64
pytest
75
pytest-asyncio
86
pytest-mock

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ python-dotenv
66
slowapi
77
starlette>=0.40.0 # Vulnerable to https://osv.dev/vulnerability/GHSA-f96h-pmfr-66vw
88
tiktoken>=0.7.0 # Support for o200k_base encoding
9-
tomli
109
uvicorn>=0.11.7 # Vulnerable to https://osv.dev/vulnerability/PYSEC-2020-150

src/gitingest/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
from gitingest.ingestion import ingest_query
66
from gitingest.query_parsing import parse_query
77

8-
__all__ = ["ingest_query", "clone_repo", "parse_query", "ingest", "ingest_async"]
8+
__all__ = ["clone_repo", "ingest", "ingest_async", "ingest_query", "parse_query"]

0 commit comments

Comments
 (0)