Skip to content

Commit 2f447ae

Browse files
chore: switch to ruff + pydoclint, deprecate .gitingest, and perform a repo-wide quality sweep (#329)
* **Pre-commit**: replace `black` & `darglint` with `ruff-check` / `ruff-format`; add `pydoclint` for docstring quality * **Deps**: drop `tomli`; tighten `typing_extensions`; add `eval-type-backport`; remove `black`, `djlint`, `pylint` from `requirements-dev` * **Ignore files**: deprecate TOML-based `.gitingest`; introduce `.gitingestignore` (git-wildmatch, parsed via `_parse_ignore_file`) * **Config**: new unified `[tool.ruff]` (lint + format + isort); delete `[tool.black]`, keep minimal `[tool.isort]` for now * **Refactor/style**: adopt `from __future__ import annotations`, kw-only args, richer types; reorder params & `__all__`; move type-only imports under `if TYPE_CHECKING`; extract `_CLIArgs` `TypedDict`, migrate form data to `pydantic.QueryForm`; deduplicate `cli.main` / `_async_main`; use `pathlib`, avoid file-IO in async; replace magic numbers with constants; delete `is_text_file` (logic now lives in `FileSystemNode.content`) * **Bug fix**: remove silent error in `notebook_utils._process_cell` * **Docs**: refresh README badges * **Tests**: update fixtures & assertions **BREAKING**: new `.gitingestignore` file replaces (now-deprecated) `.gitingest`. No functional API or CLI changes.
1 parent b39ef54 commit 2f447ae

Some content is hidden

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

54 files changed

+1758
-1509
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: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,36 @@
11
# Gitingest
22

3-
[![Image](./docs/frontpage.png "Gitingest main page")](https://gitingest.com)
3+
[![Screenshot of Gitingest front page](./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)
8-
[![Downloads](https://pepy.tech/badge/gitingest)](https://pepy.tech/project/gitingest)
9-
10-
[![Discord](https://dcbadge.limes.pink/api/server/https://discord.com/invite/zerRaGK9EC)](https://discord.com/invite/zerRaGK9EC)
5+
<!-- Badges -->
6+
<!-- markdownlint-disable MD033 -->
7+
<p align="center">
8+
<!-- row 1 — install & compat -->
9+
<a href="https://pypi.org/project/gitingest"><img src="https://img.shields.io/pypi/v/gitingest.svg" alt="PyPI"></a>
10+
<a href="https://pypi.org/project/gitingest"><img src="https://img.shields.io/pypi/pyversions/gitingest.svg" alt="Python Versions"></a>
11+
<br>
12+
<!-- row 2 — quality & community -->
13+
<a href="https://github.com/cyclotruc/gitingest/actions/workflows/ci.yml?query=branch%3Amain"><img src="https://github.com/cyclotruc/gitingest/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a>
14+
<a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff"></a>
15+
<a href="https://scorecard.dev/viewer/?uri=github.com/cyclotruc/gitingest"><img src="https://api.scorecard.dev/projects/github.com/cyclotruc/gitingest/badge" alt="OpenSSF Scorecard"></a>
16+
<br>
17+
<a href="https://github.com/cyclotruc/gitingest/blob/main/LICENSE"><img src="https://img.shields.io/github/license/cyclotruc/gitingest.svg" alt="License"></a>
18+
<a href="https://pepy.tech/project/gitingest"><img src="https://pepy.tech/badge/gitingest" alt="Downloads"></a>
19+
<a href="https://github.com/cyclotruc/gitingest"><img src="https://img.shields.io/github/stars/cyclotruc/gitingest" alt="GitHub Stars"></a>
20+
<a href="https://discord.com/invite/zerRaGK9EC"><img src="https://img.shields.io/badge/Discord-Join_chat-5865F2?logo=discord&logoColor=white" alt="Discord"></a>
21+
<br>
22+
<a href="https://trendshift.io/repositories/13519"><img src="https://trendshift.io/api/badge/repositories/13519" alt="Trendshift" height="50"></a>
23+
</p>
24+
<!-- markdownlint-enable MD033 -->
1125

1226
Turn any Git repository into a prompt-friendly text ingest for LLMs.
1327

1428
You can also replace `hub` with `ingest` in any GitHub URL to access the corresponding digest.
1529

30+
<!-- Extensions -->
1631
[gitingest.com](https://gitingest.com) · [Chrome Extension](https://chromewebstore.google.com/detail/adfjahbijlkjfoicpjkhjicpjpjfaood) · [Firefox Add-on](https://addons.mozilla.org/firefox/addon/gitingest)
1732

18-
<!-- Keep these links. Translations will automatically update with the README. -->
33+
<!-- Languages -->
1934
[Deutsch](https://www.readme-i18n.com/cyclotruc/gitingest?lang=de) |
2035
[Español](https://www.readme-i18n.com/cyclotruc/gitingest?lang=es) |
2136
[Français](https://www.readme-i18n.com/cyclotruc/gitingest?lang=fr) |

pyproject.toml

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@ readme = {file = "README.md", content-type = "text/markdown" }
66
requires-python = ">= 3.8"
77
dependencies = [
88
"click>=8.0.0",
9-
"fastapi[standard]>=0.109.1", # Vulnerable to https://osv.dev/vulnerability/PYSEC-2024-38
9+
"fastapi[standard]>=0.109.1", # Minimum safe release (https://osv.dev/vulnerability/PYSEC-2024-38)
1010
"pydantic",
1111
"python-dotenv",
1212
"slowapi",
13-
"starlette>=0.40.0", # Vulnerable to https://osv.dev/vulnerability/GHSA-f96h-pmfr-66vw
13+
"starlette>=0.40.0", # Minimum safe release (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'",
18-
"uvicorn>=0.11.7", # Vulnerable to https://osv.dev/vulnerability/PYSEC-2020-150
16+
"typing_extensions>= 4.0.0; python_version < '3.10'",
17+
"uvicorn>=0.11.7", # Minimum safe release (https://osv.dev/vulnerability/PYSEC-2020-150)
1918
]
2019

2120
license = {file = "LICENSE"}
@@ -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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""Gitingest: A package for ingesting data from Git repositories."""
22

3-
from gitingest.cloning import clone_repo
3+
from gitingest.clone import clone_repo
44
from gitingest.entrypoint import ingest, ingest_async
55
from gitingest.ingestion import ingest_query
6-
from gitingest.query_parsing import parse_query
6+
from gitingest.query_parser 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)