CapyIdx
CapyIdx indexes source repositories into SQLite and provides deterministic symbol lookup and code reconstruction. It is designed to be embedded in tools that need repository-aware code context.
Installation
python -m pip install capyidx
For development:
python -m pip install -e ".[dev]"
The core package uses Tree-sitter for source parsing and tiktoken for chunk
size calculations. Optional integrations can be installed with extras:
python -m pip install "capyidx[openai]"
python -m pip install "capyidx[ollama]"
python -m pip install "capyidx[local-embeddings]"
python -m pip install "capyidx[vector]"
Basic usage
Indexing is asynchronous. The convenience API waits for the initial pass to finish:
import asyncio
from capyidx import index_repo, lookup_symbol
async def main() -> None:
repo = "/path/to/git/repository"
await index_repo(repo)
result = await lookup_symbol(repo, "MyClass", detail="body")
for match in result.matches:
print(match.name, match.path, match.start_line, match.end_line)
if result.selected is not None:
print(result.selected.code)
asyncio.run(main())
Use index_repo_iter when progress updates are needed:
from capyidx import index_repo_iter
async for update in index_repo_iter("/path/to/git/repository"):
print(update.status, update.progress, update.desc)
Pass watch=True to continue indexing changed files after the initial pass.
The watcher uses watchdog when installed and otherwise falls back to polling.
Query workflows
lookup_symbolreturns matching symbol metadata and reconstructs a unique exact match.reconstruct_symbolreconstructs a previously selected symbol by ID.resolve_lookupreconstructs every match for a name.open_lookupreuses one database connection for multiple queries.
Use detail="signature" for declaration-only results, and use
filter_paths to restrict lookup to selected path prefixes.
Current scope
The public convenience API currently builds the chunk/symbol index and exposes
deterministic symbol retrieval. FTS, code-snippet, embedding, and LanceDB
backends are present as lower-level components but are not automatically wired
into index_repo yet.
Indexes are stored under ~/.coreIndexer/.codebase_index by default. Set
COREINDEXER_HOME to use a different data directory.
Development checks
python -m compileall -q src tests
pytest
python -m build
The repository's CI runs these checks on Python 3.10, 3.11, and 3.12.
Release files for capyidx 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| capyidx-0.1.0.tar.gz | 70.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| capyidx-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 152.5 kB
Release files / capyidx-0.1.0.tar.gz
| Download URL | capyidx-0.1.0.tar.gz |
|---|---|
| Size | 70.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b9452c812cb645036f38e3673273c6348f0ed957d09a14231c38dcb66866a0a
|
|
BLAKE2b-256 checksum How to use checksums |
80339c3caf06622f3f6727b6108ec7214ed519bd9ac505950f536ea3c9b4621e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.19
|
Release files / capyidx-0.1.0-py3-none-any.whl
| Download URL | capyidx-0.1.0-py3-none-any.whl |
|---|---|
| Size | 81.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a959f8ec429fbf2af05a734fed449c20d71c349836abd9f889f126243c281a1
|
|
BLAKE2b-256 checksum How to use checksums |
03a001d5447ce41deb7d8a24f64bfdfd657d8d1c9ede2f4aa15cf6505a689be4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.19
|