Client for indexing code repositories with semantic search
Project description
CodeIndex Client
Python client for monitoring and indexing code repositories with semantic search.
Features
- File Monitoring: Watches code files for changes (create, modify, delete)
- Smart Filtering: Only indexes recognized source code files
- Automatic Retry: Retries failed operations with exponential backoff
- In-Memory Queue: Maintains pending operations during network issues
- Multi-Language Support: Supports 40+ programming languages
Installation
Install from the repository:
pip install -e .
Or with development dependencies:
pip install -e ".[dev]"
Usage
Start the Indexing Agent
codeindex agent \
--project-id my-project \
--path /path/to/your/repo \
--server https://indexer.example.com \
--token YOUR_AUTH_TOKEN
The agent will:
- Index all existing code files
- Monitor for file changes
- Send updates to the Indexer API
- Retry failed operations automatically
Check Server Health
codeindex health \
--server https://indexer.example.com \
--token YOUR_AUTH_TOKEN
Configuration
Environment Variables
CODEINDEX_TOKEN: Authentication token (alternative to --token flag)CODEINDEX_DEBOUNCE_SECONDS: Debounce time for file changes (default: 0.5)CODEINDEX_MAX_RETRIES: Maximum retry attempts (default: 10)CODEINDEX_INITIAL_RETRY_DELAY: Initial retry delay in seconds (default: 1.0)CODEINDEX_MAX_RETRY_DELAY: Maximum retry delay in seconds (default: 60.0)CODEINDEX_RETRY_BACKOFF_FACTOR: Backoff multiplier (default: 2.0)
Supported File Extensions
The client automatically detects and indexes these file types:
- Python: .py, .pyw
- JavaScript/TypeScript: .js, .jsx, .ts, .tsx, .mjs, .cjs
- Go: .go
- Rust: .rs
- Java/Kotlin: .java, .kt, .kts
- C/C++: .c, .h, .cpp, .hpp, .cc, .hh, .cxx, .hxx
- C#: .cs
- PHP: .php
- Ruby: .rb
- Swift/Objective-C: .swift, .m, .mm
- Scala: .scala
- Shell: .sh, .bash, .zsh
- PowerShell: .ps1
- Perl: .pl, .pm
- Elixir: .ex, .exs
- Erlang: .erl
- Haskell: .hs
- Clojure: .clj, .cljs, .cljc
- Lua: .lua
- R: .R, .r
- Dart: .dart
- HTML/CSS: .html, .htm, .css, .scss, .sass, .less
- SQL: .sql
- Config: .yaml, .yml, .toml, .json
- Markdown: .md, .markdown
Ignored Directories
The following directories are automatically excluded from monitoring:
.git, .svn, .hg, node_modules, __pycache__, .pytest_cache, .mypy_cache,
.tox, venv, .venv, env, .env, dist, build, target, bin, obj,
.idea, .vscode, .DS_Store, coverage, .coverage, htmlcov
Examples
Index a Python project
codeindex agent \
--project-id my-python-app \
--path ~/projects/my-python-app \
--server http://localhost:8080 \
--token dev_token_123 \
--verbose
Index with environment variable
export CODEINDEX_TOKEN=dev_token_123
codeindex agent \
--project-id my-project \
--path . \
--server http://localhost:8080
Development
Run tests:
pytest
Run with coverage:
pytest --cov=codeindex --cov-report=html
How It Works
- Initial Scan: When started, the agent scans all code files in the directory
- Queuing: Files are added to an in-memory queue for processing
- Processing: The queue processor sends files to the Indexer API
- Monitoring: The file watcher detects changes and queues new operations
- Retry Logic: Failed operations are retried with exponential backoff
- Graceful Shutdown: Pressing Ctrl+C stops the agent cleanly
Troubleshooting
Server not responding
If the Indexer API is down, the agent will:
- Continue monitoring file changes
- Queue operations in memory
- Retry with exponential backoff
- Log warnings but not crash
High memory usage
If you have many pending operations:
- Check if the Indexer API is healthy
- Reduce the repository size or use
.gitignorepatterns - Restart the agent to clear the queue
Files not being indexed
Check:
- File extension is in the supported list
- File is not in an ignored directory
- Run with
--verboseflag to see detailed logs
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file codeindex-0.1.1.tar.gz.
File metadata
- Download URL: codeindex-0.1.1.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62c9010570a2ec24cfb55f6d2e5d635722c72171bb19ad6c47a64f4c9cd04c08
|
|
| MD5 |
85a079a03222e3567b45bbbd053889f4
|
|
| BLAKE2b-256 |
444b242bedcb2c99156c17e5812ae0ab3fc57a3fb5169458356e35a1656c85e7
|
File details
Details for the file codeindex-0.1.1-py3-none-any.whl.
File metadata
- Download URL: codeindex-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71205a42d2a3f3350feb8cff73aebfb3225522bd4fffbd40da8a165e2d4461c0
|
|
| MD5 |
c77efc2478bc4de42815b0a266ed8055
|
|
| BLAKE2b-256 |
2fd958d155ae37b7077ea95f3b9c2f728237896c763238fd3b7dbde20ba67db2
|