Thank you for your interest in contributing to context-kit!
- Python 3.9+
- uv (recommended)
git clone https://github.com/keli-wen/context-kit.git
cd context-kit
# Install all dependencies (including dev)
uv sync --all-extras
# Or with pip
pip install -e ".[all]"We use unittest (not pytest) for testing:
# Run all tests
uv run python -m pytest tests/
# Run specific test file
uv run python -m pytest tests/test_context.py
# Run with verbose output
uv run python -m pytest tests/ -vWe use ruff for linting and formatting, and mypy for type checking:
# Lint
uv run ruff check .
# Auto-fix lint issues
uv run ruff check --fix .
# Format
uv run ruff format .
# Type check
uv run mypy context_kit/- Type hints: All functions must have complete type annotations
- Docstrings: All public functions and classes must have docstrings
- Tests: New features should include tests
- Error handling:
- Core functions (
context_kit/*.py) shouldraiseexceptions - Tool/wrapper functions should catch exceptions and return error strings
- Core functions (
context_kit/
├── context.py # Core Context dataclass
├── message.py # Message format conversion
├── memory.py # Persistent memory operations
├── select.py # JIT context retrieval
├── llm.py # LLM adapters
├── tools.py # Agent-ready tool wrappers
└── util.py # Utilities (token estimation)
Examples should follow these conventions:
- One example per file with a single
main()function - Use
examples/util.pyfor consistent terminal output (Rich-based) - Place in
examples/basic/for standalone examples - Place in
examples/integrations/for framework integrations
# Example structure
from examples.util import print_header, print_success
def main():
print_header("Example Title")
# ... example code ...
print_success("Done!")
if __name__ == "__main__":
main()- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests and linting (
uv run pytest && uv run ruff check .) - Commit your changes (
git commit -m 'Add amazing feature') - Push to your branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Tests pass locally
- Code follows project style (ruff, mypy)
- New features have tests
- Public APIs have docstrings
- README updated if needed
Feel free to open an issue for questions or discussions.