chunkscope 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chunkscope-0.2.0/.gitignore +10 -0
- chunkscope-0.2.0/CHANGELOG.md +28 -0
- chunkscope-0.2.0/LICENSE +21 -0
- chunkscope-0.2.0/PKG-INFO +227 -0
- chunkscope-0.2.0/README.md +196 -0
- chunkscope-0.2.0/examples/demo_corpus/01_overview.md +61 -0
- chunkscope-0.2.0/examples/demo_corpus/02_installation.md +95 -0
- chunkscope-0.2.0/examples/demo_corpus/03_storage_engine.md +94 -0
- chunkscope-0.2.0/examples/demo_corpus/04_replication.md +62 -0
- chunkscope-0.2.0/examples/demo_corpus/05_operations_runbook.md +90 -0
- chunkscope-0.2.0/examples/demo_corpus/06_api_reference.md +73 -0
- chunkscope-0.2.0/examples/demo_corpus/07_release_notes.md +20 -0
- chunkscope-0.2.0/examples/demo_site.py +231 -0
- chunkscope-0.2.0/examples/frameworks.py +49 -0
- chunkscope-0.2.0/examples/quickstart.py +25 -0
- chunkscope-0.2.0/examples/visual_options.py +49 -0
- chunkscope-0.2.0/pyproject.toml +60 -0
- chunkscope-0.2.0/src/chunkscope/__init__.py +31 -0
- chunkscope-0.2.0/src/chunkscope/__main__.py +3 -0
- chunkscope-0.2.0/src/chunkscope/adapters.py +378 -0
- chunkscope-0.2.0/src/chunkscope/align.py +189 -0
- chunkscope-0.2.0/src/chunkscope/analyze.py +408 -0
- chunkscope-0.2.0/src/chunkscope/api.py +44 -0
- chunkscope-0.2.0/src/chunkscope/checks.py +155 -0
- chunkscope-0.2.0/src/chunkscope/cli.py +143 -0
- chunkscope-0.2.0/src/chunkscope/colors.py +181 -0
- chunkscope-0.2.0/src/chunkscope/models.py +152 -0
- chunkscope-0.2.0/src/chunkscope/py.typed +0 -0
- chunkscope-0.2.0/src/chunkscope/render.py +710 -0
- chunkscope-0.2.0/src/chunkscope/tokenizers.py +108 -0
- chunkscope-0.2.0/tests/conftest.py +16 -0
- chunkscope-0.2.0/tests/fixtures/guide.md +45 -0
- chunkscope-0.2.0/tests/test_adapters.py +177 -0
- chunkscope-0.2.0/tests/test_align.py +78 -0
- chunkscope-0.2.0/tests/test_analyze.py +91 -0
- chunkscope-0.2.0/tests/test_checks.py +92 -0
- chunkscope-0.2.0/tests/test_cli.py +49 -0
- chunkscope-0.2.0/tests/test_integration.py +96 -0
- chunkscope-0.2.0/tests/test_render.py +40 -0
- chunkscope-0.2.0/tests/test_visual_options.py +182 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0 (2026-12-02)
|
|
4
|
+
|
|
5
|
+
First public release.
|
|
6
|
+
|
|
7
|
+
### Visualization options
|
|
8
|
+
|
|
9
|
+
- **Colour by** menu in the report: chunk, size, issues, retrieval score, or a metadata field (8 categorical colours plus "other"). `color_by=` sets the initial colouring; `color_metadata=` chooses the metadata fields (picked automatically otherwise).
|
|
10
|
+
- **Chunk map**: a bird's-eye strip per document, with overlaps on extra rows and gaps marked; click a bar to jump to its chunk.
|
|
11
|
+
- **Retrieval overlay**: `scores=` and `query=`, or scored inputs directly (`(chunk, score)` pairs, LlamaIndex `NodeWithScore`, Haystack `Document.score`, dicts with `"score"`). Ranked table in the overview and a "retrieval rank" order for chunk cards.
|
|
12
|
+
- **Compare runs**: `chunkscope.compare({label: chunks})` and `chunkscope compare a.jsonl b.jsonl`. Runs table in the overview and a Compare tab per document.
|
|
13
|
+
- **Theme**: `theme="auto" | "light" | "dark"` and a toggle in the report.
|
|
14
|
+
- CLI: `--color-by`, `--theme`, `--query`.
|
|
15
|
+
- Fix: the report no longer fails when embedded in a sandboxed iframe.
|
|
16
|
+
- `compare()` accepts `scores={run label: scores}` to show retrieval for one run.
|
|
17
|
+
- Overlaps drawn in both chunks' colours with a dashed outline (clearer in dark mode).
|
|
18
|
+
- Aligner: text copied from elsewhere in the source (a repeated table header) now counts towards a partial match, and chunks are matched line by line, so a header plus a single row is no longer "unmatched".
|
|
19
|
+
- Full demo: `examples/demo_site.py` on a synthetic 7-document corpus in `examples/demo_corpus/`.
|
|
20
|
+
|
|
21
|
+
### Core
|
|
22
|
+
|
|
23
|
+
- `chunkscope.report()` / `analyze()` / `save()`, plus a `chunkscope report` CLI with JSONL/JSON input and `--fail-on` for CI.
|
|
24
|
+
- Adapters for strings, dicts, LangChain, LlamaIndex, Haystack, Chonkie, Docling and Unstructured (duck-typed, no imports).
|
|
25
|
+
- Alignment at three fidelity levels: exact offsets, search (exact, whitespace-normalized, partial), unplaced.
|
|
26
|
+
- Coverage, gaps and overlaps; size statistics with pluggable tokenizers (tiktoken, Hugging Face, any callable).
|
|
27
|
+
- Checks: size limits, empty chunks, gaps, split code blocks, split tables, mid-word and mid-sentence cuts, heading-only chunks, wrong offsets, transformed text, duplicates.
|
|
28
|
+
- Offline, single-file HTML report with source, chunk and issue views; Jupyter display.
|
chunkscope-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Achraf BELARIF
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: chunkscope
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: See how your RAG chunking splits your documents: an offline HTML report for any chunker or framework.
|
|
5
|
+
Project-URL: Homepage, https://github.com/spydersy/chunkscope
|
|
6
|
+
Project-URL: Documentation, https://github.com/spydersy/chunkscope/blob/main/docs/API.md
|
|
7
|
+
Project-URL: Repository, https://github.com/spydersy/chunkscope
|
|
8
|
+
Project-URL: Issues, https://github.com/spydersy/chunkscope/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/spydersy/chunkscope/blob/main/CHANGELOG.md
|
|
10
|
+
Author-email: Achraf Belarif <contact@belarif.com>
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: chunking,embeddings,llm,rag,retrieval,text-splitting,visualization
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Classifier: Topic :: Text Processing
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Provides-Extra: hf
|
|
27
|
+
Requires-Dist: tokenizers>=0.15; extra == 'hf'
|
|
28
|
+
Provides-Extra: tiktoken
|
|
29
|
+
Requires-Dist: tiktoken>=0.5; extra == 'tiktoken'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# chunkscope
|
|
33
|
+
|
|
34
|
+
**See how your RAG chunking splits your documents.** One line in your existing pipeline produces an offline HTML report. The report shows every chunk in place in the source text, where chunks overlap, which text ended up in no chunk, the size distribution, and the boundary bugs that quietly hurt retrieval.
|
|
35
|
+
|
|
36
|
+
- **Any chunking method:** fixed-size, recursive, sentence, Markdown or heading-aware, semantic, LLM-based, hierarchical, or your own.
|
|
37
|
+
- **Any framework, or none:** plain strings and dicts, LangChain, LlamaIndex, Haystack, Chonkie, Docling, Unstructured. Detection is automatic, and chunkscope imports none of them.
|
|
38
|
+
- **Any file type:** chunkscope shows the text your chunker actually received (from PDF, DOCX, HTML, Markdown, code…). Many chunking bugs are really extraction bugs, and this makes them visible.
|
|
39
|
+
- **Private by design:** the report is one HTML file with no network access (enforced by a Content-Security-Policy), no CDN and no telemetry. Safe for confidential documents.
|
|
40
|
+
- **No dependencies:** standard library only. Tokenizers are optional extras.
|
|
41
|
+
|
|
42
|
+
> Status: alpha (0.2.0). The API may still change. LangChain, LlamaIndex, Haystack and Chonkie are tested against the real libraries; Docling and Unstructured support is based on their documented output and not yet tested against the libraries themselves. Reports of problems are welcome in the [issues](https://github.com/spydersy/chunkscope/issues).
|
|
43
|
+
|
|
44
|
+
## All methods
|
|
45
|
+
|
|
46
|
+
| Call | Use it to |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `chunkscope.report(chunks, source=...)` | analyze and write the HTML report in one call |
|
|
49
|
+
| `chunkscope.analyze(chunks, source=...)` | get a `Report` to inspect, test or save later |
|
|
50
|
+
| `chunkscope.compare({"a": chunks_a, "b": chunks_b}, source=...)` | compare several chunkings in one report |
|
|
51
|
+
| `chunkscope.save(report, "file.html")` | write a `Report` to a file |
|
|
52
|
+
| `chunkscope.render_html(report)` | get the page as a string, to serve or store it yourself |
|
|
53
|
+
| `report.summary()`, `report.issues` | use the results in code and tests |
|
|
54
|
+
| `chunkscope.tokenizers.*` | count sizes like your embedding model (tiktoken, Hugging Face, words) |
|
|
55
|
+
| `chunkscope report` / `chunkscope compare` | the same from the command line |
|
|
56
|
+
|
|
57
|
+
Every parameter, return value, error and usage is documented in **[docs/API.md](https://github.com/spydersy/chunkscope/blob/main/docs/API.md)**. How to read and use the HTML report is explained in **[docs/REPORT.md](https://github.com/spydersy/chunkscope/blob/main/docs/REPORT.md)**.
|
|
58
|
+
|
|
59
|
+
## Install
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install chunkscope # core, no dependencies
|
|
63
|
+
pip install "chunkscope[tiktoken]" # count sizes with tiktoken
|
|
64
|
+
pip install "chunkscope[hf]" # count sizes with a Hugging Face tokenizer
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Quick start
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
import chunkscope
|
|
71
|
+
|
|
72
|
+
chunks = my_chunker(text) # strings, dicts or framework objects
|
|
73
|
+
chunkscope.report(chunks, source=text) # writes chunkscope-report.html
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Open `chunkscope-report.html` in any browser. Pass `open_browser=True` to open it automatically. In Jupyter, `chunkscope.analyze(chunks, source=text)` displays the report inline.
|
|
77
|
+
|
|
78
|
+
### With a framework
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
# LangChain: add_start_index=True gives exact offsets
|
|
82
|
+
splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=50, add_start_index=True)
|
|
83
|
+
chunks = splitter.split_documents(docs)
|
|
84
|
+
chunkscope.report(chunks, sources=docs) # chunks are matched to their document
|
|
85
|
+
|
|
86
|
+
# LlamaIndex
|
|
87
|
+
nodes = SentenceSplitter(chunk_size=256).get_nodes_from_documents(documents)
|
|
88
|
+
chunkscope.report(nodes, sources=documents)
|
|
89
|
+
|
|
90
|
+
# Haystack
|
|
91
|
+
chunks = DocumentSplitter(split_by="word", split_length=150).run(documents=docs)["documents"]
|
|
92
|
+
chunkscope.report(chunks, sources=docs)
|
|
93
|
+
|
|
94
|
+
# Chonkie: one list of chunks per text, paired with the sources by position
|
|
95
|
+
batches = RecursiveChunker(chunk_size=512).chunk_batch(texts)
|
|
96
|
+
chunkscope.report(batches, sources=texts)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Count sizes like your embedding model
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from chunkscope.tokenizers import huggingface_counter, tiktoken_counter
|
|
103
|
+
|
|
104
|
+
chunkscope.report(chunks, source=text, token_counter=huggingface_counter("BAAI/bge-small-en-v1.5"), max_tokens=512)
|
|
105
|
+
chunkscope.report(chunks, source=text, token_counter=tiktoken_counter("cl100k_base"), max_tokens=8191)
|
|
106
|
+
chunkscope.report(chunks, source=text, token_counter=my_model.tokenizer) # any tokenizer with .encode()
|
|
107
|
+
chunkscope.report(chunks, source=text, token_counter=lambda t: len(t.split()))
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Without a counter, sizes are in characters, and the report says so.
|
|
111
|
+
|
|
112
|
+
### Command line
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
chunkscope report chunks.jsonl --source guide.md --tokenizer tiktoken:cl100k_base --max-tokens 512 --open
|
|
116
|
+
chunkscope report chunks.jsonl --source-dir ./docs # chunks carry doc_id / source paths
|
|
117
|
+
chunkscope report chunks.jsonl --source guide.md --fail-on error # exit code 3 in CI if errors exist
|
|
118
|
+
chunkscope report hits.jsonl --source guide.md --query "how fine for espresso?" # chunks with a "score" field
|
|
119
|
+
chunkscope report chunks.jsonl --source guide.md --color-by meta:section --theme dark
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`chunks.jsonl` holds one chunk per line, for example `{"text": "...", "start": 0, "end": 512, "doc_id": "guide.md", "metadata": {...}}`. Only `text` is required.
|
|
123
|
+
|
|
124
|
+
## What the report shows
|
|
125
|
+
|
|
126
|
+
- **Overview:** chunk count, size distribution histogram, limit violations, coverage per document, and issues grouped by type.
|
|
127
|
+
- **Source view:** the document with each chunk highlighted in place, a marker where each chunk starts, overlaps striped, and uncovered text in red. Click any text to inspect its chunk.
|
|
128
|
+
- **Chunk cards:** text, size, offsets, metadata, alignment status and issues, with a filter to show only problem chunks.
|
|
129
|
+
|
|
130
|
+
### Checks
|
|
131
|
+
|
|
132
|
+
| Check | Severity | Meaning |
|
|
133
|
+
|---|---|---|
|
|
134
|
+
| `over_limit` / `under_limit` | error / warning | chunk is larger than `max_tokens` or smaller than `min_tokens` |
|
|
135
|
+
| `empty` | error | chunk has no text |
|
|
136
|
+
| `gaps` | warning | source text that is in no chunk, so it cannot be retrieved |
|
|
137
|
+
| `split_code_block` | warning | a code fence is opened or closed in another chunk |
|
|
138
|
+
| `starts_in_table` / `ends_in_table` | warning | table rows are separated from their header or from the rest of the table |
|
|
139
|
+
| `starts_mid_word` / `ends_mid_word` | warning | boundary cuts a word |
|
|
140
|
+
| `heading_only` | warning | chunk is just a heading, with its content elsewhere |
|
|
141
|
+
| `unmatched` | warning | chunk text cannot be found in the source |
|
|
142
|
+
| `offset_mismatch` | warning | the chunk's own offsets point to the wrong text |
|
|
143
|
+
| `ends_mid_sentence` | info | boundary falls inside a sentence |
|
|
144
|
+
| `partial` | info | the chunker transformed the text (added headers or context); only part of it was found |
|
|
145
|
+
| `duplicate` | info | same text as an earlier chunk |
|
|
146
|
+
|
|
147
|
+
## How chunks are placed
|
|
148
|
+
|
|
149
|
+
chunkscope works at three fidelity levels, so every chunker works:
|
|
150
|
+
|
|
151
|
+
1. **Exact:** the chunk carries character offsets that match the source (LangChain `start_index`, LlamaIndex `start_char_idx`, Haystack `split_idx_start`, Chonkie `start_index`).
|
|
152
|
+
2. **Aligned:** text only, or wrong offsets. chunkscope searches the source: first an exact match, then a match that ignores whitespace, then a piece-by-piece match for transformed chunks (`partial`).
|
|
153
|
+
3. **Unplaced:** text that cannot be found, or no source given. The chunk is still listed, measured and checked.
|
|
154
|
+
|
|
155
|
+
## Visualization options
|
|
156
|
+
|
|
157
|
+
Every report lets you switch between these views with the **Colour by** menu, and a **Theme** button toggles automatic, light and dark.
|
|
158
|
+
|
|
159
|
+
| Colour by | Shows |
|
|
160
|
+
|---|---|
|
|
161
|
+
| Chunk | alternating colours, to tell neighbouring chunks apart (default) |
|
|
162
|
+
| Size | one blue scale from small to large; chunks over `max_tokens` in red |
|
|
163
|
+
| Issues | the worst issue of each chunk: info, ▲ warning, ✕ error |
|
|
164
|
+
| Retrieval score | one orange scale from low to high score; unscored chunks dimmed |
|
|
165
|
+
| Metadata: *key* | one colour per value of a metadata field (section, page, heading…), with a legend; picked automatically or with `color_metadata=` |
|
|
166
|
+
|
|
167
|
+
Above the source text, the **chunk map** shows the whole document as a strip of bars: one bar per chunk, overlapping chunks on extra rows, gaps in red. Click a bar to jump to its chunk.
|
|
168
|
+
|
|
169
|
+
### See what a query retrieves
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
hits = vectorstore.similarity_search_with_score(query, k=len(chunks)) # LangChain: (Document, score) pairs
|
|
173
|
+
chunkscope.report(hits, sources=docs, query=query)
|
|
174
|
+
|
|
175
|
+
nodes = retriever.retrieve(query) # LlamaIndex: NodeWithScore
|
|
176
|
+
chunkscope.report(nodes, sources=documents, query=query)
|
|
177
|
+
|
|
178
|
+
chunkscope.report(chunks, source=text, scores=my_scores, query=query) # any retriever: one score per chunk
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
The report opens coloured by score, with a ranked table of the best chunks and a "retrieval rank" order for the chunk cards. `scores=` takes a list aligned with the chunks, or a mapping `{position or chunk id: score}` for a subset.
|
|
182
|
+
|
|
183
|
+
### Compare chunkings
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
result = chunkscope.compare(
|
|
187
|
+
{"500 / 50": splitter_a.split_documents(docs), "1000 / 100": splitter_b.split_documents(docs)},
|
|
188
|
+
sources=docs,
|
|
189
|
+
max_tokens=512,
|
|
190
|
+
)
|
|
191
|
+
chunkscope.save(result, "compare.html")
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
The overview gets a table comparing the runs. Every document gets a **Compare runs** tab with the chunk map of each run on the same scale. From the command line: `chunkscope compare small.jsonl large.jsonl --source guide.md` (each file name is a run label).
|
|
195
|
+
|
|
196
|
+
## Programmatic use
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
result = chunkscope.analyze(chunks, source=text, max_tokens=512)
|
|
200
|
+
result.summary() # {'chunks': 42, 'median_size': 380, 'over_limit': 2, 'errors': 2, 'coverage': 0.97, ...}
|
|
201
|
+
result.issues # list of Issue(code, severity, message, chunk)
|
|
202
|
+
chunkscope.save(result, "report.html")
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Use it in a test to keep your chunking honest:
|
|
206
|
+
|
|
207
|
+
```python
|
|
208
|
+
def test_chunking_quality():
|
|
209
|
+
summary = chunkscope.analyze(chunk(doc), source=doc, max_tokens=512).summary()
|
|
210
|
+
assert summary["errors"] == 0 and summary["coverage"] > 0.99
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Development
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
uv venv && uv pip install -e . pytest
|
|
217
|
+
pytest -m "not integration" # fast unit tests
|
|
218
|
+
uv pip install --group integration && pytest # also run real LangChain, LlamaIndex, Haystack, Chonkie
|
|
219
|
+
python examples/quickstart.py # writes examples/output/quickstart.html
|
|
220
|
+
python examples/demo_site.py # the full demo: 7 fictional docs, 3 chunkers, every check
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Design decisions are recorded in [docs/DESIGN.md](https://github.com/spydersy/chunkscope/blob/main/docs/DESIGN.md).
|
|
224
|
+
|
|
225
|
+
## License
|
|
226
|
+
|
|
227
|
+
MIT
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# chunkscope
|
|
2
|
+
|
|
3
|
+
**See how your RAG chunking splits your documents.** One line in your existing pipeline produces an offline HTML report. The report shows every chunk in place in the source text, where chunks overlap, which text ended up in no chunk, the size distribution, and the boundary bugs that quietly hurt retrieval.
|
|
4
|
+
|
|
5
|
+
- **Any chunking method:** fixed-size, recursive, sentence, Markdown or heading-aware, semantic, LLM-based, hierarchical, or your own.
|
|
6
|
+
- **Any framework, or none:** plain strings and dicts, LangChain, LlamaIndex, Haystack, Chonkie, Docling, Unstructured. Detection is automatic, and chunkscope imports none of them.
|
|
7
|
+
- **Any file type:** chunkscope shows the text your chunker actually received (from PDF, DOCX, HTML, Markdown, code…). Many chunking bugs are really extraction bugs, and this makes them visible.
|
|
8
|
+
- **Private by design:** the report is one HTML file with no network access (enforced by a Content-Security-Policy), no CDN and no telemetry. Safe for confidential documents.
|
|
9
|
+
- **No dependencies:** standard library only. Tokenizers are optional extras.
|
|
10
|
+
|
|
11
|
+
> Status: alpha (0.2.0). The API may still change. LangChain, LlamaIndex, Haystack and Chonkie are tested against the real libraries; Docling and Unstructured support is based on their documented output and not yet tested against the libraries themselves. Reports of problems are welcome in the [issues](https://github.com/spydersy/chunkscope/issues).
|
|
12
|
+
|
|
13
|
+
## All methods
|
|
14
|
+
|
|
15
|
+
| Call | Use it to |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `chunkscope.report(chunks, source=...)` | analyze and write the HTML report in one call |
|
|
18
|
+
| `chunkscope.analyze(chunks, source=...)` | get a `Report` to inspect, test or save later |
|
|
19
|
+
| `chunkscope.compare({"a": chunks_a, "b": chunks_b}, source=...)` | compare several chunkings in one report |
|
|
20
|
+
| `chunkscope.save(report, "file.html")` | write a `Report` to a file |
|
|
21
|
+
| `chunkscope.render_html(report)` | get the page as a string, to serve or store it yourself |
|
|
22
|
+
| `report.summary()`, `report.issues` | use the results in code and tests |
|
|
23
|
+
| `chunkscope.tokenizers.*` | count sizes like your embedding model (tiktoken, Hugging Face, words) |
|
|
24
|
+
| `chunkscope report` / `chunkscope compare` | the same from the command line |
|
|
25
|
+
|
|
26
|
+
Every parameter, return value, error and usage is documented in **[docs/API.md](https://github.com/spydersy/chunkscope/blob/main/docs/API.md)**. How to read and use the HTML report is explained in **[docs/REPORT.md](https://github.com/spydersy/chunkscope/blob/main/docs/REPORT.md)**.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install chunkscope # core, no dependencies
|
|
32
|
+
pip install "chunkscope[tiktoken]" # count sizes with tiktoken
|
|
33
|
+
pip install "chunkscope[hf]" # count sizes with a Hugging Face tokenizer
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Quick start
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
import chunkscope
|
|
40
|
+
|
|
41
|
+
chunks = my_chunker(text) # strings, dicts or framework objects
|
|
42
|
+
chunkscope.report(chunks, source=text) # writes chunkscope-report.html
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Open `chunkscope-report.html` in any browser. Pass `open_browser=True` to open it automatically. In Jupyter, `chunkscope.analyze(chunks, source=text)` displays the report inline.
|
|
46
|
+
|
|
47
|
+
### With a framework
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
# LangChain: add_start_index=True gives exact offsets
|
|
51
|
+
splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=50, add_start_index=True)
|
|
52
|
+
chunks = splitter.split_documents(docs)
|
|
53
|
+
chunkscope.report(chunks, sources=docs) # chunks are matched to their document
|
|
54
|
+
|
|
55
|
+
# LlamaIndex
|
|
56
|
+
nodes = SentenceSplitter(chunk_size=256).get_nodes_from_documents(documents)
|
|
57
|
+
chunkscope.report(nodes, sources=documents)
|
|
58
|
+
|
|
59
|
+
# Haystack
|
|
60
|
+
chunks = DocumentSplitter(split_by="word", split_length=150).run(documents=docs)["documents"]
|
|
61
|
+
chunkscope.report(chunks, sources=docs)
|
|
62
|
+
|
|
63
|
+
# Chonkie: one list of chunks per text, paired with the sources by position
|
|
64
|
+
batches = RecursiveChunker(chunk_size=512).chunk_batch(texts)
|
|
65
|
+
chunkscope.report(batches, sources=texts)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Count sizes like your embedding model
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from chunkscope.tokenizers import huggingface_counter, tiktoken_counter
|
|
72
|
+
|
|
73
|
+
chunkscope.report(chunks, source=text, token_counter=huggingface_counter("BAAI/bge-small-en-v1.5"), max_tokens=512)
|
|
74
|
+
chunkscope.report(chunks, source=text, token_counter=tiktoken_counter("cl100k_base"), max_tokens=8191)
|
|
75
|
+
chunkscope.report(chunks, source=text, token_counter=my_model.tokenizer) # any tokenizer with .encode()
|
|
76
|
+
chunkscope.report(chunks, source=text, token_counter=lambda t: len(t.split()))
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Without a counter, sizes are in characters, and the report says so.
|
|
80
|
+
|
|
81
|
+
### Command line
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
chunkscope report chunks.jsonl --source guide.md --tokenizer tiktoken:cl100k_base --max-tokens 512 --open
|
|
85
|
+
chunkscope report chunks.jsonl --source-dir ./docs # chunks carry doc_id / source paths
|
|
86
|
+
chunkscope report chunks.jsonl --source guide.md --fail-on error # exit code 3 in CI if errors exist
|
|
87
|
+
chunkscope report hits.jsonl --source guide.md --query "how fine for espresso?" # chunks with a "score" field
|
|
88
|
+
chunkscope report chunks.jsonl --source guide.md --color-by meta:section --theme dark
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`chunks.jsonl` holds one chunk per line, for example `{"text": "...", "start": 0, "end": 512, "doc_id": "guide.md", "metadata": {...}}`. Only `text` is required.
|
|
92
|
+
|
|
93
|
+
## What the report shows
|
|
94
|
+
|
|
95
|
+
- **Overview:** chunk count, size distribution histogram, limit violations, coverage per document, and issues grouped by type.
|
|
96
|
+
- **Source view:** the document with each chunk highlighted in place, a marker where each chunk starts, overlaps striped, and uncovered text in red. Click any text to inspect its chunk.
|
|
97
|
+
- **Chunk cards:** text, size, offsets, metadata, alignment status and issues, with a filter to show only problem chunks.
|
|
98
|
+
|
|
99
|
+
### Checks
|
|
100
|
+
|
|
101
|
+
| Check | Severity | Meaning |
|
|
102
|
+
|---|---|---|
|
|
103
|
+
| `over_limit` / `under_limit` | error / warning | chunk is larger than `max_tokens` or smaller than `min_tokens` |
|
|
104
|
+
| `empty` | error | chunk has no text |
|
|
105
|
+
| `gaps` | warning | source text that is in no chunk, so it cannot be retrieved |
|
|
106
|
+
| `split_code_block` | warning | a code fence is opened or closed in another chunk |
|
|
107
|
+
| `starts_in_table` / `ends_in_table` | warning | table rows are separated from their header or from the rest of the table |
|
|
108
|
+
| `starts_mid_word` / `ends_mid_word` | warning | boundary cuts a word |
|
|
109
|
+
| `heading_only` | warning | chunk is just a heading, with its content elsewhere |
|
|
110
|
+
| `unmatched` | warning | chunk text cannot be found in the source |
|
|
111
|
+
| `offset_mismatch` | warning | the chunk's own offsets point to the wrong text |
|
|
112
|
+
| `ends_mid_sentence` | info | boundary falls inside a sentence |
|
|
113
|
+
| `partial` | info | the chunker transformed the text (added headers or context); only part of it was found |
|
|
114
|
+
| `duplicate` | info | same text as an earlier chunk |
|
|
115
|
+
|
|
116
|
+
## How chunks are placed
|
|
117
|
+
|
|
118
|
+
chunkscope works at three fidelity levels, so every chunker works:
|
|
119
|
+
|
|
120
|
+
1. **Exact:** the chunk carries character offsets that match the source (LangChain `start_index`, LlamaIndex `start_char_idx`, Haystack `split_idx_start`, Chonkie `start_index`).
|
|
121
|
+
2. **Aligned:** text only, or wrong offsets. chunkscope searches the source: first an exact match, then a match that ignores whitespace, then a piece-by-piece match for transformed chunks (`partial`).
|
|
122
|
+
3. **Unplaced:** text that cannot be found, or no source given. The chunk is still listed, measured and checked.
|
|
123
|
+
|
|
124
|
+
## Visualization options
|
|
125
|
+
|
|
126
|
+
Every report lets you switch between these views with the **Colour by** menu, and a **Theme** button toggles automatic, light and dark.
|
|
127
|
+
|
|
128
|
+
| Colour by | Shows |
|
|
129
|
+
|---|---|
|
|
130
|
+
| Chunk | alternating colours, to tell neighbouring chunks apart (default) |
|
|
131
|
+
| Size | one blue scale from small to large; chunks over `max_tokens` in red |
|
|
132
|
+
| Issues | the worst issue of each chunk: info, ▲ warning, ✕ error |
|
|
133
|
+
| Retrieval score | one orange scale from low to high score; unscored chunks dimmed |
|
|
134
|
+
| Metadata: *key* | one colour per value of a metadata field (section, page, heading…), with a legend; picked automatically or with `color_metadata=` |
|
|
135
|
+
|
|
136
|
+
Above the source text, the **chunk map** shows the whole document as a strip of bars: one bar per chunk, overlapping chunks on extra rows, gaps in red. Click a bar to jump to its chunk.
|
|
137
|
+
|
|
138
|
+
### See what a query retrieves
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
hits = vectorstore.similarity_search_with_score(query, k=len(chunks)) # LangChain: (Document, score) pairs
|
|
142
|
+
chunkscope.report(hits, sources=docs, query=query)
|
|
143
|
+
|
|
144
|
+
nodes = retriever.retrieve(query) # LlamaIndex: NodeWithScore
|
|
145
|
+
chunkscope.report(nodes, sources=documents, query=query)
|
|
146
|
+
|
|
147
|
+
chunkscope.report(chunks, source=text, scores=my_scores, query=query) # any retriever: one score per chunk
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
The report opens coloured by score, with a ranked table of the best chunks and a "retrieval rank" order for the chunk cards. `scores=` takes a list aligned with the chunks, or a mapping `{position or chunk id: score}` for a subset.
|
|
151
|
+
|
|
152
|
+
### Compare chunkings
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
result = chunkscope.compare(
|
|
156
|
+
{"500 / 50": splitter_a.split_documents(docs), "1000 / 100": splitter_b.split_documents(docs)},
|
|
157
|
+
sources=docs,
|
|
158
|
+
max_tokens=512,
|
|
159
|
+
)
|
|
160
|
+
chunkscope.save(result, "compare.html")
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
The overview gets a table comparing the runs. Every document gets a **Compare runs** tab with the chunk map of each run on the same scale. From the command line: `chunkscope compare small.jsonl large.jsonl --source guide.md` (each file name is a run label).
|
|
164
|
+
|
|
165
|
+
## Programmatic use
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
result = chunkscope.analyze(chunks, source=text, max_tokens=512)
|
|
169
|
+
result.summary() # {'chunks': 42, 'median_size': 380, 'over_limit': 2, 'errors': 2, 'coverage': 0.97, ...}
|
|
170
|
+
result.issues # list of Issue(code, severity, message, chunk)
|
|
171
|
+
chunkscope.save(result, "report.html")
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Use it in a test to keep your chunking honest:
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
def test_chunking_quality():
|
|
178
|
+
summary = chunkscope.analyze(chunk(doc), source=doc, max_tokens=512).summary()
|
|
179
|
+
assert summary["errors"] == 0 and summary["coverage"] > 0.99
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Development
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
uv venv && uv pip install -e . pytest
|
|
186
|
+
pytest -m "not integration" # fast unit tests
|
|
187
|
+
uv pip install --group integration && pytest # also run real LangChain, LlamaIndex, Haystack, Chonkie
|
|
188
|
+
python examples/quickstart.py # writes examples/output/quickstart.html
|
|
189
|
+
python examples/demo_site.py # the full demo: 7 fictional docs, 3 chunkers, every check
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Design decisions are recorded in [docs/DESIGN.md](https://github.com/spydersy/chunkscope/blob/main/docs/DESIGN.md).
|
|
193
|
+
|
|
194
|
+
## License
|
|
195
|
+
|
|
196
|
+
MIT
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Quillstore Overview
|
|
2
|
+
|
|
3
|
+
> Quillstore is a fictional product. This documentation was written to demonstrate chunkscope and describes no real software.
|
|
4
|
+
|
|
5
|
+
## What Quillstore Is
|
|
6
|
+
|
|
7
|
+
Quillstore is an embedded, persistent key-value store for services that need fast local reads and durable writes without running a separate database server. It links into your application as a library, stores data in a single directory, and can optionally replicate that directory to two or more peers.
|
|
8
|
+
|
|
9
|
+
Quillstore is designed for three workloads: session and cache data that must survive restarts, event logs that are written once and read in order, and configuration snapshots that change rarely but must be identical on every node.
|
|
10
|
+
|
|
11
|
+
## Core Concepts
|
|
12
|
+
|
|
13
|
+
### Keyspaces
|
|
14
|
+
|
|
15
|
+
A keyspace is a named collection of keys with its own settings. Each keyspace chooses a compaction strategy, a compression codec and a retention policy. Keys are byte strings of up to 4 KiB; values can be up to 64 MiB, although values above 1 MiB are stored out of line in blob files.
|
|
16
|
+
|
|
17
|
+
### Records and Versions
|
|
18
|
+
|
|
19
|
+
Every write creates a new version of a record. A version carries a 64-bit sequence number assigned by the writer, a timestamp, and an optional time-to-live. Readers see the latest version unless they open a snapshot, which pins the sequence number at the moment it was created.
|
|
20
|
+
|
|
21
|
+
### The Write-Ahead Log
|
|
22
|
+
|
|
23
|
+
Before a write is acknowledged, it is appended to the write-ahead log (WAL) and, depending on the durability level, flushed to disk. The WAL is the only structure that must be written synchronously; everything else is rebuilt from it after a crash.
|
|
24
|
+
|
|
25
|
+
### Segments
|
|
26
|
+
|
|
27
|
+
Data on disk lives in immutable segment files. A segment holds sorted keys, a sparse index and a Bloom filter. Segments are merged in the background by compaction, which discards overwritten and expired versions.
|
|
28
|
+
|
|
29
|
+
## Architecture at a Glance
|
|
30
|
+
|
|
31
|
+
A Quillstore node has four layers. The table below lists them from the application down to the disk.
|
|
32
|
+
|
|
33
|
+
| Layer | Responsibility | Main settings |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| API | Get, put, delete, scan, transactions | `max_batch_bytes`, `read_timeout` |
|
|
36
|
+
| Memtable | In-memory sorted buffer for recent writes | `memtable_size`, `memtable_count` |
|
|
37
|
+
| Storage engine | WAL, segments, compaction, blob files | `durability`, `compaction`, `codec` |
|
|
38
|
+
| Replication | Log shipping to peers, leader election | `peers`, `quorum`, `election_timeout` |
|
|
39
|
+
|
|
40
|
+
Each layer can be tuned independently, but the defaults are chosen to work well together for small and medium datasets of up to a few hundred gigabytes per node.
|
|
41
|
+
|
|
42
|
+
## When Not to Use Quillstore
|
|
43
|
+
|
|
44
|
+
Quillstore is not a relational database. It has no query planner, no joins and no secondary indexes beyond what you build yourself with additional keyspaces. It is also not designed for datasets that do not fit on one machine: replication copies the whole dataset to every peer instead of sharding it.
|
|
45
|
+
|
|
46
|
+
If you need ad-hoc queries across many fields, or a dataset that grows beyond a single node's disk, use a dedicated database server instead.
|
|
47
|
+
|
|
48
|
+
## Glossary
|
|
49
|
+
|
|
50
|
+
| Term | Meaning |
|
|
51
|
+
|---|---|
|
|
52
|
+
| Blob file | A file holding large values outside the segments |
|
|
53
|
+
| Compaction | Background merging of segments to reclaim space |
|
|
54
|
+
| Durability level | How far a write must travel before it is acknowledged |
|
|
55
|
+
| Leader | The peer that accepts writes in a replicated group |
|
|
56
|
+
| Memtable | The in-memory buffer of recent writes |
|
|
57
|
+
| Quorum | The number of peers that must confirm a replicated write |
|
|
58
|
+
| Segment | An immutable sorted file of keys and values |
|
|
59
|
+
| Snapshot | A consistent read view pinned to one sequence number |
|
|
60
|
+
| Tombstone | A marker that records the deletion of a key |
|
|
61
|
+
| WAL | Write-ahead log, the append-only record of every write |
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Installation and Configuration
|
|
2
|
+
|
|
3
|
+
> Quillstore is a fictional product. This documentation was written to demonstrate chunkscope and describes no real software.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
Quillstore runs on 64-bit Linux and macOS. It needs a filesystem that supports `fsync` on directories, which rules out some network filesystems. For production, use a local SSD and reserve at least twice the size of your dataset, because compaction temporarily needs room for both the old and the new segments.
|
|
8
|
+
|
|
9
|
+
## Installing the Library
|
|
10
|
+
|
|
11
|
+
The library is published for Python, Go and Rust. Pick the package for your language:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install quillstore # Python 3.10 or newer
|
|
15
|
+
go get example.org/quillstore/v2 # Go 1.22 or newer
|
|
16
|
+
cargo add quillstore # Rust 2021 edition
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The command-line tool, `quill`, is installed with the Python package. It is used for inspection, backups and recovery and never needs to run while your application is running.
|
|
20
|
+
|
|
21
|
+
## Opening a Store
|
|
22
|
+
|
|
23
|
+
A store is opened on a directory. If the directory is empty, Quillstore creates the files it needs.
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
import quillstore
|
|
27
|
+
|
|
28
|
+
store = quillstore.open(
|
|
29
|
+
"/var/lib/myapp/store",
|
|
30
|
+
durability="fsync",
|
|
31
|
+
memtable_size="64MiB",
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
with store.transaction() as tx:
|
|
35
|
+
tx.put(b"user:42", b'{"name": "Ada"}')
|
|
36
|
+
tx.put(b"user:43", b'{"name": "Grace"}')
|
|
37
|
+
|
|
38
|
+
print(store.get(b"user:42"))
|
|
39
|
+
store.close()
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Always close the store before the process exits. Closing flushes the memtable and writes a clean-shutdown marker, which makes the next start faster because the WAL does not need to be replayed.
|
|
43
|
+
|
|
44
|
+
## Configuration File
|
|
45
|
+
|
|
46
|
+
Instead of passing options in code, you can keep them in a `quillstore.toml` file next to the data directory. Options passed in code override the file.
|
|
47
|
+
|
|
48
|
+
```toml
|
|
49
|
+
[store]
|
|
50
|
+
durability = "fsync"
|
|
51
|
+
memtable_size = "64MiB"
|
|
52
|
+
memtable_count = 2
|
|
53
|
+
|
|
54
|
+
[keyspace.sessions]
|
|
55
|
+
compaction = "tiered"
|
|
56
|
+
codec = "lz4"
|
|
57
|
+
ttl = "24h"
|
|
58
|
+
|
|
59
|
+
[keyspace.events]
|
|
60
|
+
compaction = "leveled"
|
|
61
|
+
codec = "zstd"
|
|
62
|
+
retention = "30d"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Configuration Reference
|
|
66
|
+
|
|
67
|
+
The table below lists every store-level option, its default and when to change it.
|
|
68
|
+
|
|
69
|
+
| Option | Default | Description |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| `durability` | `fsync` | `none`, `flush` or `fsync`; see the storage engine guide |
|
|
72
|
+
| `memtable_size` | `32MiB` | Size at which a memtable is frozen and written to a segment |
|
|
73
|
+
| `memtable_count` | `2` | Number of memtables kept in memory, including frozen ones |
|
|
74
|
+
| `max_batch_bytes` | `4MiB` | Largest batch a single transaction may write |
|
|
75
|
+
| `read_timeout` | `2s` | Time a read waits for a lock before failing |
|
|
76
|
+
| `compaction_threads` | `2` | Background threads used for compaction |
|
|
77
|
+
| `blob_threshold` | `1MiB` | Values above this size are stored in blob files |
|
|
78
|
+
| `codec` | `lz4` | Default compression: `none`, `lz4` or `zstd` |
|
|
79
|
+
| `bloom_bits_per_key` | `10` | Bloom filter size; higher means fewer false positives |
|
|
80
|
+
| `cache_size` | `256MiB` | Block cache shared by all keyspaces |
|
|
81
|
+
| `max_open_files` | `1000` | Segment files kept open at the same time |
|
|
82
|
+
| `checksum` | `crc32c` | Checksum used for WAL entries and segment blocks |
|
|
83
|
+
| `peers` | empty | Addresses of replication peers |
|
|
84
|
+
| `quorum` | `majority` | Peers that must confirm a replicated write |
|
|
85
|
+
| `election_timeout` | `1500ms` | Time without a heartbeat before peers elect a new leader |
|
|
86
|
+
|
|
87
|
+
Most applications only change `durability`, `memtable_size` and `cache_size`. The others exist for unusual workloads and are safe to leave at their defaults.
|
|
88
|
+
|
|
89
|
+
## Environment Variables
|
|
90
|
+
|
|
91
|
+
Two environment variables are read at startup. `QUILL_LOG` sets the log level (`error`, `warn`, `info` or `debug`), and `QUILL_CONFIG` points to a configuration file in a different location. Environment variables never override options passed in code.
|
|
92
|
+
|
|
93
|
+
## Upgrading
|
|
94
|
+
|
|
95
|
+
Quillstore reads data written by the previous two minor versions. To upgrade across more versions, upgrade one step at a time and open the store once at each step, which converts the segment format. Never downgrade a store that has been opened by a newer version: older versions refuse to open it, to prevent silent data loss.
|