Skip to content

Commit d8aef79

Browse files
authored
Merge pull request #33 from Chetic/pypi-package
feat: restructure as PyPI package with src layout
2 parents e87684d + e4aad31 commit d8aef79

29 files changed

Lines changed: 1569 additions & 1543 deletions

‎.github/workflows/manual-release.yml‎

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,30 @@ jobs:
250250
--notes-file release-notes.md \
251251
packages/*.tar.gz
252252
253-
- name: Delete workflow artifacts
254-
env:
255-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
253+
254+
publish_pypi:
255+
needs: [prepare, release]
256+
runs-on: ubuntu-latest
257+
environment: pypi
258+
permissions:
259+
id-token: write
260+
steps:
261+
- uses: actions/checkout@v4
262+
263+
- uses: actions/setup-python@v5
264+
with:
265+
python-version: '3.11'
266+
267+
- name: Set package version
256268
run: |
257-
set -eo pipefail
258-
echo "Deleting Actions Artifacts..."
259-
gh api "repos/$GITHUB_REPOSITORY/actions/artifacts" --paginate -q '.artifacts[].id' | while read -r ARTIFACT_ID; do
260-
echo "Deleting artifact $ARTIFACT_ID"
261-
gh api "repos/$GITHUB_REPOSITORY/actions/artifacts/$ARTIFACT_ID" -X DELETE
262-
done
269+
VERSION="${{ needs.prepare.outputs.version }}"
270+
sed -i "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
271+
sed -i "s/^__version__ = .*/__version__ = \"$VERSION\"/" src/chunksilo/__init__.py
272+
273+
- name: Build package
274+
run: |
275+
pip install build
276+
python -m build
277+
278+
- name: Publish to PyPI
279+
uses: pypa/gh-action-pypi-publish@release/v1

‎.github/workflows/test-functional.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ jobs:
2323
- name: Install dependencies
2424
run: |
2525
python -m pip install --upgrade pip
26-
python -m pip install -r requirements.txt
27-
python -m pip install -r test/requirements.txt
26+
python -m pip install -e ".[confluence,test]"
2827
2928
- name: Check dependency licenses
3029
run: |
@@ -43,6 +42,7 @@ jobs:
4342
/tmp/license-check-venv/bin/pip install --quiet --upgrade pip
4443
/tmp/license-check-venv/bin/pip install --quiet \
4544
-r requirements.txt \
45+
"llama-index-readers-confluence>=0.6.0,<1" \
4646
-c scripts/manylinux_2_34-constraints.txt
4747
/tmp/license-check-venv/bin/pip install --quiet pip-licenses
4848
/tmp/license-check-venv/bin/pip-licenses --partial-match \
@@ -57,7 +57,7 @@ jobs:
5757
DATA_DIR: ./test_data_dummy
5858
STORAGE_DIR: ./test_storage_dummy
5959
run: |
60-
python index.py --download-models
60+
python -m chunksilo.index --download-models
6161
6262
- name: Run all functional tests
6363
env:

‎.github/workflows/test-rag-metrics.yml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ jobs:
2626
- name: Install dependencies
2727
run: |
2828
python -m pip install --upgrade pip
29-
python -m pip install -r requirements.txt
30-
python -m pip install -r test/requirements.txt
29+
python -m pip install -e ".[confluence,test]"
3130
3231
- name: Run RAG metrics test suite
3332
env:

‎README.md‎

Lines changed: 145 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ChunkSilo is like a local Google for your documents. It uses semantic search —
1111

1212
## Features
1313

14-
- **Local indexing and search**: All indexing and search runs on your machine with bundled models — ChunkSilo itself makes no external network calls when `offline: true` (default). Note: search results are passed to your MCP client's LLM, which may be cloud-hosted.
14+
- **Local indexing and search**: All indexing and search runs on your machine with bundled models — ChunkSilo itself makes no external network calls when `offline: true`. Note: search results are passed to your MCP client's LLM, which may be cloud-hosted.
1515
- **Incremental indexing**: Only reindexes new or changed files, so re-runs are fast even on large document collections.
1616
- **Heading-aware navigation**: Extracts headings from PDFs, Word docs, and Markdown so results include the full heading path (e.g. "Chapter 3 > Setup > Prerequisites").
1717
- **Date filtering and recency boost**: Search within a date range or let recent documents rank higher automatically.
@@ -20,9 +20,29 @@ ChunkSilo is like a local Google for your documents. It uses semantic search —
2020
- **Confluence integration**: Optionally searches your Confluence instance alongside local files, with results returned in the same format.
2121
- **Source links**: Each result includes a clickable link back to the source file or Confluence page in supported MCP clients.
2222

23-
## Quick Installation
23+
## Installation
2424

25-
Download the latest release package from the [Releases page](https://github.com/Chetic/chunksilo/releases).
25+
### Option A: Install from PyPI (Recommended)
26+
27+
Requires Python 3.11 or later. Models are downloaded automatically on first run (~250MB). The first run may appear to pause while models download — this is normal.
28+
29+
```bash
30+
pip install chunksilo
31+
32+
# Or with Confluence support:
33+
pip install chunksilo[confluence]
34+
```
35+
36+
Then:
37+
1. **Create** a config file at `~/.config/chunksilo/config.yaml` (see [Configuration](#configuration))
38+
2. **Build** the index: `chunksilo --build-index`
39+
3. **Configure** your MCP client (see [MCP Client Configuration](#mcp-client-configuration))
40+
41+
### Option B: Offline Bundle
42+
43+
A self-contained package with pre-downloaded models, ideal for air-gapped environments or systems without Python installed.
44+
45+
Download from the [Releases page](https://github.com/Chetic/chunksilo/releases):
2646

2747
1. **Download** the `chunksilo-vX.Y.Z-manylinux_2_34_x86_64.tar.gz` file
2848
2. **Extract** and install:
@@ -34,7 +54,7 @@ cd chunksilo
3454
```
3555

3656
3. **Edit** `config.yaml` to set your document directories
37-
4. **Build** the index: `./venv/bin/python index.py`
57+
4. **Build** the index: `./venv/bin/chunksilo --build-index`
3858
5. **Configure** your MCP client (see [MCP Client Configuration](#mcp-client-configuration))
3959

4060
## Configuration
@@ -46,7 +66,7 @@ ChunkSilo uses a single configuration file: `config.yaml`
4666
Edit `config.yaml` to configure your settings:
4767

4868
```yaml
49-
# Indexing settings - used by index.py when building the search index
69+
# Indexing settings - used by chunksilo --build-index
5070
indexing:
5171
directories:
5272
- "./data"
@@ -57,12 +77,11 @@ indexing:
5777
chunk_size: 1600
5878
chunk_overlap: 200
5979

60-
# Retrieval settings - used by chunksilo.py when searching
80+
# Retrieval settings - used when searching
6181
retrieval:
6282
embed_top_k: 20
6383
rerank_top_k: 5
6484
score_threshold: 0.1
65-
offline: true
6685

6786
# Confluence integration (optional)
6887
confluence:
@@ -80,7 +99,7 @@ All settings are optional and have sensible defaults.
8099
81100
### Configuration Reference
82101
83-
#### Indexing Settings (used by index.py)
102+
#### Indexing Settings
84103
85104
| Setting | Default | Description |
86105
| :--- | :--- | :--- |
@@ -98,7 +117,7 @@ All settings are optional and have sensible defaults.
98117
| `recursive` | `true` | Whether to recurse into subdirectories |
99118
| `enabled` | `true` | Whether to index this directory |
100119

101-
#### Retrieval Settings (used by chunksilo.py)
120+
#### Retrieval Settings
102121

103122
| Setting | Default | Description |
104123
| :--- | :--- | :--- |
@@ -111,10 +130,12 @@ All settings are optional and have sensible defaults.
111130
| `retrieval.recency_boost` | `0.3` | Recency boost weight (0.0-1.0) |
112131
| `retrieval.recency_half_life_days` | `365` | Days until recency boost halves |
113132
| `retrieval.bm25_similarity_top_k` | `10` | Files returned by BM25 filename search |
114-
| `retrieval.offline` | `true` | Prevent ML library network requests |
133+
| `retrieval.offline` | `false` | Prevent ML library network requests |
115134

116135
#### Confluence Settings (optional)
117136

137+
> **Note:** Confluence integration requires the optional dependency. Install with: `pip install chunksilo[confluence]`
138+
118139
| Setting | Default | Description |
119140
| :--- | :--- | :--- |
120141
| `confluence.url` | `""` | Confluence base URL (empty = disabled) |
@@ -136,21 +157,95 @@ All settings are optional and have sensible defaults.
136157
| `storage.storage_dir` | `./storage` | Directory for vector index and state |
137158
| `storage.model_cache_dir` | `./models` | Directory for model cache |
138159

160+
## CLI Usage
161+
162+
The `chunksilo` command provides indexing, searching, and model management:
163+
164+
```bash
165+
# Build or update the search index
166+
chunksilo --build-index
167+
168+
# Search for documents
169+
chunksilo "your search query"
170+
171+
# Search with date filtering
172+
chunksilo "quarterly report" --date-from 2024-01-01 --date-to 2024-03-31
173+
174+
# Output results as JSON
175+
chunksilo "search query" --json
176+
177+
# Show verbose output (model loading, search stats)
178+
chunksilo "search query" --verbose
179+
180+
# Pre-download ML models (useful before going offline)
181+
chunksilo --download-models
182+
183+
# Use a custom config file
184+
chunksilo --build-index --config /path/to/config.yaml
185+
```
186+
187+
### CLI Options
188+
189+
| Option | Description |
190+
| :--- | :--- |
191+
| `query` | Search query text (positional argument) |
192+
| `--build-index` | Build or update the search index, then exit |
193+
| `--download-models` | Download required ML models, then exit |
194+
| `--date-from` | Start date filter (YYYY-MM-DD format, inclusive) |
195+
| `--date-to` | End date filter (YYYY-MM-DD format, inclusive) |
196+
| `--json` | Output results as JSON instead of formatted text |
197+
| `-v, --verbose` | Show diagnostic messages (model loading, search stats) |
198+
| `--config` | Path to config.yaml (overrides auto-discovery) |
199+
139200
## MCP Client Configuration
140201

141202
Configure your MCP client to run ChunkSilo. Below are examples for common clients.
142203

143-
### Claude Desktop / Generic MCP Client
204+
> **Note:** For PyPI installs, use `chunksilo-mcp` directly. For offline bundles, use the full path `/path/to/chunksilo/venv/bin/chunksilo-mcp`. You can find the PyPI-installed binary location with `which chunksilo-mcp`.
205+
206+
### Claude Code
207+
208+
Add chunksilo as an MCP server using the CLI:
144209

145-
Add to your MCP client's configuration file:
210+
**PyPI install:**
211+
```bash
212+
claude mcp add chunksilo --scope user -- chunksilo-mcp --config ~/.config/chunksilo/config.yaml
213+
```
214+
215+
**Offline bundle:**
216+
```bash
217+
claude mcp add chunksilo --scope user -- /path/to/chunksilo/venv/bin/chunksilo-mcp --config /path/to/chunksilo/config.yaml
218+
```
219+
220+
Verify it's connected:
146221

222+
```bash
223+
claude mcp list
224+
```
225+
226+
### Claude Desktop
227+
228+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
229+
230+
**PyPI install:**
231+
```json
232+
{
233+
"mcpServers": {
234+
"chunksilo": {
235+
"command": "chunksilo-mcp",
236+
"args": ["--config", "/path/to/config.yaml"]
237+
}
238+
}
239+
}
240+
```
241+
242+
**Offline bundle:**
147243
```json
148244
{
149245
"mcpServers": {
150246
"chunksilo": {
151-
"command": "/path/to/chunksilo/venv/bin/python",
152-
"args": ["chunksilo.py"],
153-
"cwd": "/path/to/chunksilo"
247+
"command": "/path/to/chunksilo/venv/bin/chunksilo-mcp",
248+
"args": ["--config", "/path/to/chunksilo/config.yaml"]
154249
}
155250
}
156251
}
@@ -160,13 +255,27 @@ Add to your MCP client's configuration file:
160255

161256
Add to `cline_mcp_settings.json` (typically in `~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/`):
162257

258+
**PyPI install:**
259+
```json
260+
{
261+
"mcpServers": {
262+
"chunksilo": {
263+
"command": "chunksilo-mcp",
264+
"args": ["--config", "/path/to/config.yaml"],
265+
"disabled": false,
266+
"autoApprove": []
267+
}
268+
}
269+
}
270+
```
271+
272+
**Offline bundle:**
163273
```json
164274
{
165275
"mcpServers": {
166276
"chunksilo": {
167-
"command": "/path/to/chunksilo/venv/bin/python",
168-
"args": ["chunksilo.py"],
169-
"cwd": "/path/to/chunksilo",
277+
"command": "/path/to/chunksilo/venv/bin/chunksilo-mcp",
278+
"args": ["--config", "/path/to/chunksilo/config.yaml"],
170279
"disabled": false,
171280
"autoApprove": []
172281
}
@@ -178,24 +287,36 @@ Add to `cline_mcp_settings.json` (typically in `~/.config/Code/User/globalStorag
178287

179288
Add to `mcp_settings.json` (typically in `~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/`):
180289

290+
**PyPI install:**
291+
```json
292+
{
293+
"mcpServers": {
294+
"chunksilo": {
295+
"command": "chunksilo-mcp",
296+
"args": ["--config", "/path/to/config.yaml"]
297+
}
298+
}
299+
}
300+
```
301+
302+
**Offline bundle:**
181303
```json
182304
{
183305
"mcpServers": {
184306
"chunksilo": {
185-
"command": "/path/to/chunksilo/venv/bin/python",
186-
"args": ["chunksilo.py"],
187-
"cwd": "/path/to/chunksilo"
307+
"command": "/path/to/chunksilo/venv/bin/chunksilo-mcp",
308+
"args": ["--config", "/path/to/chunksilo/config.yaml"]
188309
}
189310
}
190311
}
191312
```
192313

193314
## Troubleshooting
194315

195-
- **Index missing**: Run `./venv/bin/python index.py` in the install directory.
316+
- **Index missing**: Run `chunksilo --build-index` (PyPI install) or `./venv/bin/chunksilo --build-index` (offline bundle).
196317
- **Retrieval errors**: Check paths in your MCP client configuration.
197-
- **Offline mode**: The release package includes models and sets `offline: true` by default. Set `retrieval.offline: false` in `config.yaml` if you need network access.
198-
- **Confluence Integration**: Set `confluence.url`, `confluence.username`, and `confluence.api_token` in `config.yaml` to enable Confluence search.
318+
- **Offline mode**: PyPI installs default to `offline: false` (models auto-download). The offline bundle includes pre-downloaded models and sets `offline: true`. Set `retrieval.offline: true` in `config.yaml` to prevent network calls after initial model download.
319+
- **Confluence Integration**: Install with `pip install chunksilo[confluence]`, then set `confluence.url`, `confluence.username`, and `confluence.api_token` in `config.yaml`.
199320
- **Custom CA Bundle**: Set `ssl.ca_bundle_path` in `config.yaml` for custom certificates.
200321
- **Network mounts**: Unavailable directories are skipped with a warning; indexing continues with available directories.
201322
- **Legacy .doc files**: Requires LibreOffice to be installed for automatic conversion to .docx. If LibreOffice is not found, .doc files are skipped with a warning. Full heading extraction is supported.

0 commit comments

Comments
 (0)