Skip to content

Commit eee5716

Browse files
SonAIengineclaude
andcommitted
chore: pre-commit hook + langchain_core import 가드 + README anchor 호환성
## pre-commit hook (.pre-commit-config.yaml) - ruff check --fix + ruff format hooks (CI lint job mirror) - pre-commit을 dev 의존성에 추가, CONTRIBUTING/README에 설치 안내 - 누적 lint fail이 5개 commit 이어진 사고를 구조적으로 차단 ## langchain_core importorskip 가드 - tests/test_gateway_{e2e,token_saving,xgen_workflow}.py - langchain_core 미설치 환경에서 collection error → skip 으로 전환 - 로컬 개발 마찰 제거 (CI는 --all-extras로 영향 없음) ## README anchor 호환성 - 외부 링크에서 자주 사용될 3개 헤딩 복원: Install → Installation, Docs → Documentation, Advanced → Advanced Features - README.md, README-ko.md 양쪽 동기화 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3d419c0 commit eee5716

File tree

9 files changed

+183
-25
lines changed

9 files changed

+183
-25
lines changed

.pre-commit-config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Pre-commit hooks for graph-tool-call
2+
#
3+
# Install once per clone:
4+
# pip install pre-commit
5+
# pre-commit install
6+
#
7+
# Run manually on all files:
8+
# pre-commit run --all-files
9+
#
10+
# These hooks mirror the CI lint job (.github/workflows/ci.yml).
11+
# If they fail locally, CI will also fail — fix before committing.
12+
13+
repos:
14+
- repo: https://github.com/astral-sh/ruff-pre-commit
15+
rev: v0.15.4
16+
hooks:
17+
- id: ruff
18+
name: ruff check
19+
args: [--fix]
20+
- id: ruff-format
21+
name: ruff format

CONTRIBUTING.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,19 @@ Contributions are welcome! Here's how to get started.
77
```bash
88
git clone https://github.com/SonAIengine/graph-tool-call.git
99
cd graph-tool-call
10-
pip install poetry
10+
pip install poetry pre-commit
1111
poetry install --with dev --all-extras
12+
pre-commit install # auto-runs ruff on every commit
13+
```
14+
15+
The `pre-commit install` step wires up `.pre-commit-config.yaml` so that
16+
`ruff check --fix` and `ruff format` run automatically before each commit.
17+
This catches the same lint issues CI checks, before they reach the remote.
18+
19+
To run the hooks manually on the whole tree:
20+
21+
```bash
22+
pre-commit run --all-files
1223
```
1324

1425
## Running Tests

README-ko.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@
3939

4040
- [왜 필요한가](#왜-필요한가)
4141
- [동작 원리](#동작-원리)
42-
- [설치](#설치)
42+
- [Installation](#installation)
4343
- [Quick Start](#quick-start)
4444
- [통합 패턴 고르기](#통합-패턴-고르기)
4545
- [벤치마크](#벤치마크)
46-
- [Advanced](#advanced)
47-
- [문서](#문서)
46+
- [Advanced Features](#advanced-features)
47+
- [Documentation](#documentation)
4848
- [Contributing](#contributing)
4949

5050
</details>
@@ -105,7 +105,7 @@ graph-tool-call은 tool 하나가 아니라 체인 전체를 반환한다. 검
105105

106106
---
107107

108-
## 설치
108+
## Installation
109109

110110
코어 패키지는 **의존성 0** — Python 표준 라이브러리만 사용. 필요한 것만 골라 설치하면 된다.
111111

@@ -303,7 +303,7 @@ python -m benchmarks.run_benchmark --mode pipeline -m qwen3:4b # 전체 파
303303

304304
---
305305

306-
## Advanced
306+
## Advanced Features
307307

308308
### Embedding 기반 hybrid search
309309

@@ -368,7 +368,7 @@ tg.auto_organize(llm=openai.OpenAI())
368368

369369
---
370370

371-
## 문서
371+
## Documentation
372372

373373
| 문서 | 설명 |
374374
|---|---|
@@ -390,8 +390,9 @@ tg.auto_organize(llm=openai.OpenAI())
390390
```bash
391391
git clone https://github.com/SonAIengine/graph-tool-call.git
392392
cd graph-tool-call
393-
pip install poetry
393+
pip install poetry pre-commit
394394
poetry install --with dev --all-extras
395+
pre-commit install # 매 commit 전 ruff 자동 실행
395396

396397
# Test, lint, benchmark
397398
poetry run pytest -v

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ English · [한국어](README-ko.md) · [中文](README-zh_CN.md) · [日本語]
3939

4040
- [Why](#why)
4141
- [How it works](#how-it-works)
42-
- [Install](#install)
42+
- [Installation](#installation)
4343
- [Quick Start](#quick-start)
4444
- [Choose your integration](#choose-your-integration)
4545
- [Benchmark](#benchmark)
46-
- [Advanced](#advanced)
47-
- [Docs](#docs)
46+
- [Advanced Features](#advanced-features)
47+
- [Documentation](#documentation)
4848
- [Contributing](#contributing)
4949

5050
</details>
@@ -105,7 +105,7 @@ graph-tool-call returns the entire chain, not just one tool. Retrieval combines
105105

106106
---
107107

108-
## Install
108+
## Installation
109109

110110
The core package has **zero dependencies** — just Python standard library. Install only what you need:
111111

@@ -303,7 +303,7 @@ python -m benchmarks.run_benchmark --mode pipeline -m qwen3:4b # full pipelin
303303

304304
---
305305

306-
## Advanced
306+
## Advanced Features
307307

308308
### Embedding-based hybrid search
309309

@@ -368,7 +368,7 @@ Builds richer categories, relations, and search keywords. Supports Ollama, OpenA
368368

369369
---
370370

371-
## Docs
371+
## Documentation
372372

373373
| Doc | Description |
374374
|---|---|
@@ -390,8 +390,9 @@ Contributions are welcome.
390390
```bash
391391
git clone https://github.com/SonAIengine/graph-tool-call.git
392392
cd graph-tool-call
393-
pip install poetry
393+
pip install poetry pre-commit
394394
poetry install --with dev --all-extras
395+
pre-commit install # auto-runs ruff on every commit
395396

396397
# Test, lint, benchmark
397398
poetry run pytest -v

poetry.lock

Lines changed: 125 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ all = ["networkx", "pyyaml", "numpy", "sentence-transformers", "rapidfuzz", "lan
7070
pytest = "^8.0"
7171
pytest-asyncio = "^0.23"
7272
ruff = ">=0.11"
73+
pre-commit = "^4.0"
7374
langgraph-bigtool = "^0.0.3"
7475

7576
[tool.ruff]

tests/test_gateway_e2e.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
import json
99
import time
1010

11-
from langchain_core.tools import tool
12-
1311
pytest = __import__("pytest")
12+
pytest.importorskip("langchain_core")
13+
pytest.importorskip("langgraph")
1414
ChatOllama = pytest.importorskip("langchain_ollama").ChatOllama
15+
from langchain_core.tools import tool # noqa: E402
1516
from langgraph.prebuilt import create_react_agent # noqa: E402
1617

1718
from graph_tool_call.langchain.gateway import create_gateway_tools # noqa: E402

tests/test_gateway_token_saving.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010
import json
1111

12-
from langchain_core.tools import tool
13-
1412
pytest = __import__("pytest")
13+
pytest.importorskip("langchain_core")
1514
ChatOllama = pytest.importorskip("langchain_ollama").ChatOllama
15+
from langchain_core.tools import tool # noqa: E402
1616

1717
from graph_tool_call.langchain.gateway import create_gateway_tools # noqa: E402
1818

0 commit comments

Comments
 (0)