siftcode 0.3.0__py3-none-any.whl

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.
@@ -0,0 +1,413 @@
1
+ Metadata-Version: 2.4
2
+ Name: siftcode
3
+ Version: 0.3.0
4
+ Summary: Local LLM-powered code analysis and developer guide generator
5
+ Author-email: Tuomas Lähteenmäki <lahtis@gmail.com>
6
+ License-Expression: GPL-3.0-or-later
7
+ Project-URL: Homepage, https://codeberg.org/lahtis/siftcode
8
+ Project-URL: Repository, https://codeberg.org/lahtis/siftcode
9
+ Project-URL: Issues, https://codeberg.org/lahtis/siftcode/issues
10
+ Project-URL: Changelog, https://codeberg.org/lahtis/siftcode/src/branch/main/CHANGELOG.md
11
+ Keywords: llm,ollama,documentation,code-analysis,gtk
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: X11 Applications :: GTK
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Software Development :: Documentation
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: requests>=2.31
22
+ Requires-Dist: PyGObject>=3.46
23
+ Requires-Dist: platformdirs>=4.0
24
+ Requires-Dist: tomli-w>=1.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.4; extra == "dev"
27
+ Requires-Dist: pytest-cov>=4.1; extra == "dev"
28
+ Requires-Dist: ruff>=0.1; extra == "dev"
29
+ Requires-Dist: mypy>=1.7; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # Siftcode
33
+
34
+ > Local LLM-powered code analysis and developer guide generator.
35
+
36
+ **Siftcode** analyzes software projects using a locally-running language
37
+ model (via [Ollama](https://ollama.com)) and produces:
38
+
39
+ - **Per-file summaries** — what each file does, its functions, and how it fits
40
+ - **Per-directory summaries** — how files work together
41
+ - **A comprehensive Markdown developer guide** — architecture, setup, API reference, and examples
42
+
43
+ Everything runs on your own hardware. **No code leaves your machine.**
44
+
45
+ ---
46
+
47
+ ## Why Siftcode?
48
+
49
+ Reading an unfamiliar codebase is slow. Documentation is often outdated
50
+ or missing entirely. Existing AI tools send your code to a cloud service,
51
+ which is a non-starter for proprietary or sensitive projects.
52
+
53
+ Siftcode combines three things that no other tool offers together:
54
+
55
+ 1. **100 % local** — your code never leaves your machine
56
+ 2. **Project-wide context** — each file is analyzed with the project's
57
+ structure and sibling files already in view
58
+ 3. **A cache** — re-analysis skips files that haven't changed, making
59
+ iterative work fast
60
+
61
+ The result is a well-organized developer guide you can actually use,
62
+ generated in minutes.
63
+
64
+ ---
65
+
66
+ ## Features
67
+
68
+ - **Local-first**: runs entirely on your hardware via [Ollama](https://ollama.com)
69
+ - **Cache-aware**: unchanged files are never re-analyzed — second runs
70
+ are up to 10× faster
71
+ - **Project-wide context**: file analyses see the root summary and
72
+ sibling files, producing coherent guides
73
+ - **Progress feedback**: a live progress bar and log during analysis
74
+ - **Cancellable**: stop an analysis mid-run without losing your work
75
+ - **Configurable per project**: model, context size, temperature, file
76
+ exclusions, and cache settings are all saved per project
77
+ - **Two front-ends**: a modern GTK4 + libadwaita GUI and a scriptable CLI
78
+ - **Tested**: 200+ unit tests, ~95 % coverage in the core
79
+
80
+ ---
81
+
82
+ ## Screenshots
83
+
84
+ ### Project list
85
+
86
+ ![Project list](https://codeberg.org/lahtis/siftcode/raw/branch/main/docs/screenshots/projects.png)
87
+
88
+ ### Settings
89
+
90
+ ![Settings](https://codeberg.org/lahtis/siftcode/raw/branch/main/docs/screenshots/settings.png)
91
+
92
+ ### Analysis in progress
93
+
94
+ ![Analysis](https://codeberg.org/lahtis/siftcode/raw/branch/main/docs/screenshots/analyzing.png)
95
+
96
+ ### Generated developer guide
97
+
98
+ ![Guide](https://codeberg.org/lahtis/siftcode/raw/branch/main/docs/screenshots/guide.png)
99
+ ---
100
+
101
+ ## Requirements
102
+
103
+ - **Linux** (X11 or Wayland)
104
+ - **Python 3.11** or newer
105
+ - **GTK 4.10+** and **libadwaita 1.4+**
106
+ - **[Ollama](https://ollama.com)** running locally
107
+ - A code-capable LLM installed via Ollama, for example:
108
+
109
+ ```bash
110
+ ollama pull qwen2.5-coder:14b
111
+ ```
112
+
113
+ ### Hardware
114
+
115
+ Siftcode runs on modest hardware, but quality and speed depend on your
116
+ GPU and the model you choose.
117
+
118
+ | Model | VRAM (Q4) | ~42-file run | Quality | Best for |
119
+ |---|---|---|---|---|
120
+ | `qwen2.5-coder:7b` | ~5 GB | ~3 min | Basic | Small projects, laptops |
121
+ | **`qwen2.5-coder:14b`** | **~10 GB** | **~7 min** | **Good** | **Recommended default** |
122
+ | `qwen2.5-coder:32b` | ~22 GB | ~33 min | Excellent | Workstations, best quality |
123
+
124
+ For CUDA GPUs, ensure your driver is recent enough for your Ollama
125
+ build. CPU-only operation works but is slow (expect 5–15× longer runs).
126
+
127
+
128
+ **Observations from real runs:**
129
+
130
+ - **14B** produces a comprehensive guide in ~7 minutes. It occasionally
131
+ mentions files that don't exist (e.g. `setup.py` in a modern
132
+ `pyproject.toml` project). These are easy to spot and correct.
133
+ - **32B** is ~4.5× slower but produces a more accurate guide — notably
134
+ it no longer invents `setup.py`. However, its output is more
135
+ concise and may skip smaller files.
136
+ - **7B** is useful for small projects or when you need a quick pass.
137
+
138
+ **Tip:** With 32 GB+ RAM and a workstation-class GPU, you can keep
139
+ both 14B and 32B loaded at the same time:
140
+
141
+ ```bash
142
+ export OLLAMA_MAX_LOADED_MODELS=2
143
+ export OLLAMA_KV_CACHE_TYPE=q8_0
144
+ ```
145
+
146
+ This lets you use 14B for quick iterations and 32B for the final
147
+ guide without reloading models from disk.
148
+
149
+ For CUDA GPUs, ensure your driver is recent enough for your Ollama
150
+ build. CPU-only operation works but is slow (expect 5–15× longer runs).
151
+
152
+ ### Recommended context length
153
+
154
+ The default `num_ctx` has been increased from 8192 to 32768
155
+ tokens.
156
+
157
+ **Why:** The guide generation prompt includes the root summary,
158
+ all directory summaries, and all file summaries. For a 40-file
159
+ project, this is roughly 23,000 tokens. With `num_ctx=8192`,
160
+ Ollama truncates the context and the model never sees most of
161
+ the files — the guide ends up mentioning only a handful of
162
+ modules.
163
+
164
+ **Verification:** A real-world 40-file Python project required
165
+ 23,575 tokens for complete context. With `num_ctx=32768`, the
166
+ generated guide mentions 20+ modules including `analyzer.py`,
167
+ `cache.py`, `cli.py`, and all GUI views.
168
+
169
+ **VRAM:** With 14B Q4_K_M + `OLLAMA_KV_CACHE_TYPE=q8_0`, VRAM
170
+ usage is ~13 GB. Comfortably within 24 GB.
171
+
172
+ ---
173
+
174
+ ## Installation
175
+
176
+ ### From source (recommended for now)
177
+
178
+ ```bash
179
+ git clone https://codeberg.org/lahtis/siftcode.git
180
+ cd siftcode
181
+ python3 -m venv .venv
182
+ source .venv/bin/activate
183
+ pip install -e ".[dev]"
184
+ ```
185
+
186
+ ### Verify installation
187
+
188
+ ```bash
189
+ siftcode --version
190
+ # → siftcode 0.3.0
191
+
192
+ siftcode about
193
+ # → prints version, author, and license
194
+ ```
195
+
196
+ ### System dependencies (Ubuntu / Debian)
197
+
198
+ ```bash
199
+ sudo apt install \
200
+ python3-dev python3-gi python3-gi-cairo \
201
+ gir1.2-gtk-4.0 libadwaita-1-0 gir1.2-adw-1 \
202
+ libgirepository1.0-dev libcairo2-dev pkg-config
203
+ ```
204
+
205
+ ### System dependencies (Fedora)
206
+
207
+ ```bash
208
+ sudo dnf install \
209
+ python3-devel python3-gobject gtk4 libadwaita \
210
+ gobject-introspection-devel cairo-devel pkg-config
211
+ ```
212
+
213
+ ---
214
+
215
+ ## Usage
216
+
217
+ ### GUI
218
+
219
+ ```bash
220
+ siftcode-gui
221
+ ```
222
+
223
+ 1. Click the **+** button to add a project directory.
224
+ 2. Double-click the project to open its settings.
225
+ 3. Adjust the model, context size, and exclusions if needed.
226
+ 4. Click **Analyze** to start.
227
+ 5. When finished, click **Open guide** to view the generated Markdown.
228
+
229
+ ### CLI
230
+
231
+ ```bash
232
+ # Register a project under a friendly name
233
+ siftcode add /path/to/project --name "My Project"
234
+
235
+ # List saved projects
236
+ siftcode list
237
+
238
+ # Show a project's configuration
239
+ siftcode show "My Project"
240
+
241
+ # Analyze it (standard run)
242
+ siftcode analyze "My Project" --output ~/siftcode-output
243
+
244
+ # Analyze it with advanced per-file technical specifications
245
+ siftcode analyze "My Project" --output ~/siftcode-output --advanced
246
+
247
+ # Delete a project
248
+ siftcode delete "My Project"
249
+ ```
250
+
251
+ The CLI also works without registering:
252
+
253
+ ```bash
254
+ siftcode analyze /path/to/project --output ./docs
255
+ ```
256
+
257
+ ```bash
258
+ siftcode analyze /path/to/project --output ./docs --advanced
259
+ ```
260
+ ### Cache management
261
+
262
+ ```bash
263
+ siftcode cache stats # show entry counts and sizes
264
+ siftcode cache clear # remove everything
265
+ siftcode cache clear --model qwen2.5-coder:14b
266
+ siftcode cache gc --days 30 # prune entries unused for 30 days
267
+ ```
268
+
269
+ ### Output
270
+
271
+ Analysis produces two files in the output directory:
272
+
273
+ - `findings.json` — raw structured findings (root, directories, files, errors)
274
+ - `guide.md` — the generated developer guide
275
+ - `docs/specs/` — advanced per-file technical specifications (when `--advanced` is used)
276
+
277
+ ---
278
+
279
+ ## Configuration
280
+
281
+ Siftcode stores project configurations in the standard XDG config
282
+ directory:
283
+
284
+ ```
285
+ ~/.config/siftcode/projects/<slug>.toml
286
+ ```
287
+
288
+ Each project's TOML file records:
289
+
290
+ - Project name, path, and notes
291
+ - Model name, Ollama URL, context size, temperature, timeout
292
+ - File exclusion patterns
293
+ - Cache settings
294
+ - Last run timestamp
295
+
296
+ Cache data lives in:
297
+
298
+ ```
299
+ ~/.cache/siftcode/
300
+ ```
301
+
302
+ The GUI exposes all of these settings; the TOML file is
303
+ human-readable and can be edited by hand if you prefer.
304
+
305
+ ---
306
+
307
+ ## How it works
308
+
309
+ 1. **Root analysis** — the LLM sees the project tree and infers the
310
+ main language(s), purpose, and architecture.
311
+ 2. **File analysis** — each file is analyzed with the root summary and
312
+ the summaries of sibling files already in view.
313
+ 3. **Directory summaries** — the LLM summarizes each directory based
314
+ on the file summaries it contains.
315
+ 4. **Guide generation** — all of the above is composed into a
316
+ structured Markdown developer guide.
317
+ 5. **Advanced specs (optional)** — when `--advanced` is used, individual
318
+ per-file technical specifications are generated and stored in `docs/specs/`.
319
+
320
+ Each step is cached by SHA-256 hash of the input. When you re-run on an
321
+ unchanged project, only the guide is regenerated.
322
+
323
+ ---
324
+
325
+ ## Development
326
+
327
+ ```bash
328
+ # Clone and install with dev dependencies
329
+ git clone https://codeberg.org/lahtis/siftcode.git
330
+ cd siftcode
331
+ python3 -m venv .venv
332
+ source .venv/bin/activate
333
+ pip install -e ".[dev]"
334
+
335
+ # Run the test suite
336
+ pytest --cov=siftcode --cov-report=term-missing
337
+
338
+ # Lint
339
+ ruff check src/ tests/
340
+
341
+ # Type-check
342
+ mypy src/
343
+ ```
344
+
345
+ ### Project layout
346
+
347
+ ```
348
+ siftcode/
349
+ ├── src/siftcode/
350
+ │ ├── _version.py # single source of truth for metadata
351
+ │ ├── cli.py # command-line interface
352
+ │ ├── core/ # framework-agnostic logic
353
+ │ │ ├── analyzer.py # analysis engine
354
+ │ │ ├── cache.py # hash-based cache
355
+ │ │ ├── config.py # project configuration
356
+ │ │ ├── llm.py # Ollama client
357
+ │ │ ├── prompts.py # prompt templates
358
+ │ │ └── manual.py # Advanced Technical Analysis & Specification Generator
359
+ │ └── gui/ # GTK4 front-end
360
+ │ ├── app.py
361
+ │ ├── window.py
362
+ │ ├── project_list.py
363
+ │ ├── settings_view.py
364
+ │ ├── analyzer_view.py
365
+ │ └── widgets/
366
+ ├── tests/ # unit tests
367
+ └── pyproject.toml
368
+ ```
369
+
370
+ The `core/` package has **no GTK dependencies** and is usable from any
371
+ Python program.
372
+
373
+ ---
374
+
375
+ ## Contributing
376
+
377
+ Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for
378
+ guidelines on:
379
+
380
+ - Reporting bugs
381
+ - Suggesting features
382
+ - Submitting pull requests
383
+ - Coding style and testing
384
+
385
+ For translations, open an issue on Codeberg — the string table is not
386
+ yet extracted, but that will come.
387
+
388
+ ---
389
+
390
+ ## License
391
+
392
+ Siftcode is free software: you can redistribute it and/or modify it
393
+ under the terms of the **GNU General Public License** as published by
394
+ the Free Software Foundation, either version 3 of the License, or (at
395
+ your option) any later version.
396
+
397
+ See [LICENSE](LICENSE) for the full text.
398
+
399
+ Copyright © 2026 Tuomas Lähteenmäki
400
+
401
+ ---
402
+
403
+ ## Acknowledgements
404
+
405
+ Siftcode stands on the shoulders of excellent open-source projects:
406
+
407
+ - [GTK 4](https://gtk.org) and [libadwaita](https://gnome.pages.gitlab.gnome.org/libadwaita/) — the GUI toolkit
408
+ - [Ollama](https://ollama.com) — local LLM runtime
409
+ - [Qwen2.5-Coder](https://huggingface.co/Qwen/Qwen2.5-Coder-32B) — the recommended model
410
+ - [platformdirs](https://github.com/platformdirs/platformdirs) — XDG directory handling
411
+ - [tomli-w](https://github.com/hukkin/tomli-w) — TOML writing
412
+
413
+ Thank you to the maintainers of these projects.
@@ -0,0 +1,31 @@
1
+ siftcode/__init__.py,sha256=inZRLbKr2Hvh1sVCuzI3V0tIiVuOmnW_8UD-PScMaLk,75
2
+ siftcode/__main__.py,sha256=Y4sl9JXs-nTkFB-8hpLVaHANuLaJMPEAzVzAoSFeJKc,173
3
+ siftcode/_version.py,sha256=zM_ctEoYRqbPN5xDrCPEPjy7lPj3dA_wDprTCXzC9_k,1918
4
+ siftcode/cli.py,sha256=MgcqdyWQB_EHIqnLj0iyo2JYFVLXwFh8tQP6lI36aQs,17170
5
+ siftcode/core/__init__.py,sha256=qKN43TBs4HvA-QrY6zBrlvMcOnzRfVQmKeROCUAOX6o,52
6
+ siftcode/core/analyzer.py,sha256=s60t2MmS3qqqPlgBC1O_n_x83-2HlpbQdlPlHyHF_CM,20712
7
+ siftcode/core/cache.py,sha256=7VBY8ZTECgDkYOGgnwyGMNLwCUwwOMPY8XDtNcoqdyU,9780
8
+ siftcode/core/config.py,sha256=X8lIS_pAy9nvLYHh4twpHjstcThYa4zcuANi1CtgR6I,8313
9
+ siftcode/core/llm.py,sha256=IY3OMdllEhpVWh36RdAEBkGM2g_BjmFngwHuG0f04Gw,9632
10
+ siftcode/core/manual.py,sha256=jIwYmHU3OJRswBAx6xarI0BIU3AQ3f7HCNFSPi027cU,7889
11
+ siftcode/core/prompts.py,sha256=wy1KEoA9gD9nvslKzLTDU989dz6H4dF3WA-DuVMFuHM,7068
12
+ siftcode/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ siftcode/data/siftcode-logo.png,sha256=uCkXCVWO1KHxDI6P8BOmPRYc7qWuKKz6sVzFaDKJKt4,398215
14
+ siftcode/gui/__init__.py,sha256=Us6Q4ey0PeHjnoXzH-CWfQ16goi1ep4XKpdgQbFpiKM,271
15
+ siftcode/gui/analyzer_view.py,sha256=a993QWXVPjq8hLMRxH7PvKeOPzxEgITYqgHCw_J69Dw,21198
16
+ siftcode/gui/app.py,sha256=Rm5hU5r1QrJK5ry_7yUK8u1nqZ3yF2fuTKBYsmqcODU,7290
17
+ siftcode/gui/guide_window.py,sha256=6SGMj5jjUDYAQwjb8c7oGEN-pL9onooj_S4CnMmnkEc,2689
18
+ siftcode/gui/project_list.py,sha256=rswzN_xZdzij-C0cIy0GS9AYNrfqS9lXyqMRDGbsMAo,5222
19
+ siftcode/gui/settings_view.py,sha256=Zqkyi7lOu_SAVtJvJo_Vqdvpc9_JLSS9yz7K1KAJ2Tg,15828
20
+ siftcode/gui/window.py,sha256=hVVGMyjDSNabfHGc7Qj2d_PFRZfmVTNI9PUXNgO41r8,15202
21
+ siftcode/gui/widgets/__init__.py,sha256=H_ttgUQfiRQRl_3y65K5sthEYSK_cycnRJ0jpcZA7ks,41
22
+ siftcode/gui/widgets/exclusion_list.py,sha256=i0wb0mXOuFOXbo2D-tbE7oQxT9ilpE8fpa7cC-s7Dlk,5799
23
+ siftcode/gui/widgets/log_view.py,sha256=h72YVJL8Z6_jCM0KW_s5e68OIGKe9oycIxo5L9aMN8Y,3646
24
+ siftcode/gui/widgets/markdown_view.py,sha256=g1EWCb9ylbdEMKso31sHNL26qcbJmwo_Y6jj1X3n_14,6965
25
+ siftcode/gui/widgets/project_row.py,sha256=agZ1huT-UvsrJQjotm8D0ax93j-PIZniSvvR5cjO1Hc,4724
26
+ siftcode-0.3.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
27
+ siftcode-0.3.0.dist-info/METADATA,sha256=ObytxF_kc1sORerCthd7skJ-MampGWoZdi4tpNPB-8s,12306
28
+ siftcode-0.3.0.dist-info/WHEEL,sha256=a-udL2m4V_6Yn8b-uKzWb12RjRxwwMo6ohYFM24tpaY,91
29
+ siftcode-0.3.0.dist-info/entry_points.txt,sha256=d1JirDrfmZ92Bdh2SmmvfiZiidfj-OlQwBClRFopFsI,104
30
+ siftcode-0.3.0.dist-info/top_level.txt,sha256=vu-_jUd_mpqNGL621YYXUQJLY7MVDFBr_lJ9qZmVJxQ,9
31
+ siftcode-0.3.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,5 @@
1
+ [console_scripts]
2
+ siftcode = siftcode.__main__:main
3
+
4
+ [gui_scripts]
5
+ siftcode-gui = siftcode.gui.app:main