Skip to content

Commit 3b8dc63

Browse files
authored
Ast fork (#92)
1 parent e309f29 commit 3b8dc63

6 files changed

Lines changed: 51 additions & 9 deletions

File tree

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@
1414
[submodule "packages/leann-backend-hnsw/third_party/libzmq"]
1515
path = packages/leann-backend-hnsw/third_party/libzmq
1616
url = https://github.com/zeromq/libzmq.git
17+
[submodule "packages/astchunk-leann"]
18+
path = packages/astchunk-leann
19+
url = git@github.com:yichuan-w/astchunk-leann.git
20+
branch = main

docs/ast_chunking_guide.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@ leann build my-code-index --docs ./src --use-ast-chunking
2626
uv pip install -e "."
2727
```
2828

29+
#### For normal users (PyPI install)
30+
- Use `pip install leann` or `uv pip install leann`.
31+
- `astchunk` is pulled automatically from PyPI as a dependency; no extra steps.
32+
33+
#### For developers (from source, editable)
34+
```bash
35+
git clone https://github.com/yichuan-w/LEANN.git leann
36+
cd leann
37+
git submodule update --init --recursive
38+
uv sync
39+
```
40+
- This repo vendors `astchunk` as a git submodule at `packages/astchunk-leann` (our fork).
41+
- `[tool.uv.sources]` maps the `astchunk` package to that path in editable mode.
42+
- You can edit code under `packages/astchunk-leann` and Python will use your changes immediately (no separate `pip install astchunk` needed).
43+
2944
## Best Practices
3045

3146
### When to Use AST Chunking

docs/grep_search.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ configs = searcher.search("server_port=", use_grep=True)
7171
### Search Process
7272

7373
```
74-
Query: "def train_model"
74+
Query: "def train_model"
7575
7676
grep -i -n "def train_model" documents.leann.passages.jsonl
7777
@@ -130,14 +130,14 @@ from leann.api import LeannSearcher
130130
def demonstrate_grep_search():
131131
# Initialize searcher
132132
searcher = LeannSearcher("my_index")
133-
133+
134134
print("=== Function Search ===")
135135
functions = searcher.search("def __init__", use_grep=True, top_k=5)
136136
for i, result in enumerate(functions, 1):
137137
print(f"{i}. Score: {result.score}")
138138
print(f" Preview: {result.text[:60]}...")
139139
print()
140-
140+
141141
print("=== Error Search ===")
142142
errors = searcher.search("FileNotFoundError", use_grep=True, top_k=3)
143143
for result in errors:

packages/astchunk-leann

Submodule astchunk-leann added at a453701

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ wechat-exporter = "wechat_exporter.main:main"
9999
leann-core = { path = "packages/leann-core", editable = true }
100100
leann-backend-diskann = { path = "packages/leann-backend-diskann", editable = true }
101101
leann-backend-hnsw = { path = "packages/leann-backend-hnsw", editable = true }
102+
astchunk = { path = "packages/astchunk-leann", editable = true }
102103

103104
[tool.ruff]
104105
target-version = "py39"

uv.lock

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

0 commit comments

Comments
 (0)