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
Metadata
Release files for codeindex 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| codeindex-0.1.1.tar.gz | 13.1 kB | Without provenance | Details for codeindex-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| codeindex-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for codeindex-0.1.1-py3-none-any.whl |
Total release size: 25.7 kB
Release files / codeindex-0.1.1.tar.gz
| Download URL | codeindex-0.1.1.tar.gz |
|---|---|
| Size | 13.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
62c9010570a2ec24cfb55f6d2e5d635722c72171bb19ad6c47a64f4c9cd04c08
|
|
BLAKE2b-256 checksum How to use checksums |
444b242bedcb2c99156c17e5812ae0ab3fc57a3fb5169458356e35a1656c85e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / codeindex-0.1.1-py3-none-any.whl
| Download URL | codeindex-0.1.1-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
71205a42d2a3f3350feb8cff73aebfb3225522bd4fffbd40da8a165e2d4461c0
|
|
BLAKE2b-256 checksum How to use checksums |
2fd958d155ae37b7077ea95f3b9c2f728237896c763238fd3b7dbde20ba67db2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Security for codeindex 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.