Skip to main content

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:

  1. Index all existing code files
  2. Monitor for file changes
  3. Send updates to the Indexer API
  4. 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

  1. Initial Scan: When started, the agent scans all code files in the directory
  2. Queuing: Files are added to an in-memory queue for processing
  3. Processing: The queue processor sends files to the Indexer API
  4. Monitoring: The file watcher detects changes and queues new operations
  5. Retry Logic: Failed operations are retried with exponential backoff
  6. 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 .gitignore patterns
  • 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 --verbose flag to see detailed logs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codeindex-0.1.1.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codeindex-0.1.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

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

Hashes for codeindex-0.1.1.tar.gz
Algorithm Hash digest
SHA256 62c9010570a2ec24cfb55f6d2e5d635722c72171bb19ad6c47a64f4c9cd04c08
MD5 85a079a03222e3567b45bbbd053889f4
BLAKE2b-256 444b242bedcb2c99156c17e5812ae0ab3fc57a3fb5169458356e35a1656c85e7

See more details on using hashes here.

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

Hashes for codeindex-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 71205a42d2a3f3350feb8cff73aebfb3225522bd4fffbd40da8a165e2d4461c0
MD5 c77efc2478bc4de42815b0a266ed8055
BLAKE2b-256 2fd958d155ae37b7077ea95f3b9c2f728237896c763238fd3b7dbde20ba67db2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page