We welcome contributions to the LLM Interactive Proxy! This guide covers the contribution workflow, pull request guidelines, and code review process.
- Python 3.10 or higher
- Git
- GitHub account
- Familiarity with the project (read README.md)
-
Fork the repository on GitHub
-
Clone your fork:
git clone https://github.com/YOUR_USERNAME/llm-interactive-proxy.git cd llm-interactive-proxy -
Add upstream remote:
git remote add upstream https://github.com/matdev83/llm-interactive-proxy.git
-
Create virtual environment:
python -m venv .venv
-
Activate virtual environment:
- Windows:
.\.venv\Scripts\activate - Linux/macOS:
source .venv/bin/activate
- Windows:
-
Install dependencies:
./.venv/Scripts/python.exe -m pip install -e .[dev]
-
Install pre-commit hooks:
./.venv/Scripts/python.exe dev/scripts/install-hooks.py
# Update your main branch
git checkout main
git pull upstream main
# Create feature branch
git checkout -b feature/your-feature-nameBranch Naming Conventions:
feature/- New featuresfix/- Bug fixesdocs/- Documentation changesrefactor/- Code refactoringtest/- Test additions or improvements
Follow Test-Driven Development (TDD):
-
Write tests first:
# Create test file # tests/unit/test_your_feature.py
-
Run tests (should fail):
./.venv/Scripts/python.exe -m pytest tests/unit/test_your_feature.py
-
Implement feature:
# src/module.py -
Run tests (should pass):
./.venv/Scripts/python.exe -m pytest tests/unit/test_your_feature.py
-
Run all tests:
./.venv/Scripts/python.exe -m pytest
# Format code
./.venv/Scripts/python.exe -m black .
# Lint code
./.venv/Scripts/python.exe -m ruff check --fix .
# Type check
./.venv/Scripts/python.exe -m mypy src/
# Run all tests with coverage
./.venv/Scripts/python.exe -m pytest --cov=srcUse Conventional Commits format:
type(scope): subject
body (optional)
footer (optional)
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Test additions or improvementschore: Build process or auxiliary tool changes
Examples:
git commit -m "feat(connectors): add support for new LLM provider"
git commit -m "fix(loop-detection): correct pattern matching logic"
git commit -m "docs(readme): update installation instructions"git push origin feature/your-feature-name- Go to your fork on GitHub
- Click "New Pull Request"
- Select your feature branch
- Fill out the PR template:
- Title: Use Conventional Commits format
- Description: Explain what and why
- Related Issues: Link to related issues
- Testing: Describe how you tested
- Screenshots: If applicable
Use Conventional Commits format:
feat(scope): add new feature
fix(scope): fix bug in component
docs(scope): update documentation
Include:
- What: What does this PR do?
- Why: Why is this change needed?
- How: How does it work?
- Testing: How was it tested?
- Related Issues: Fixes #123, Closes #456
Template:
## Description
Brief description of the changes.
## Motivation
Why is this change needed? What problem does it solve?
## Changes
- Change 1
- Change 2
- Change 3
## Testing
How was this tested?
- [ ] Unit tests added/updated
- [ ] Integration tests added/updated
- [ ] Manual testing performed
## Related Issues
Fixes #123Before submitting, ensure:
- Tests pass locally
- Code is formatted (black)
- Code is linted (ruff)
- Type checking passes (mypy)
- Documentation is updated
- Commit messages follow Conventional Commits
- PR description is complete
- Pre-commit hooks pass
- Initial review: Within 2-3 business days
- Follow-up reviews: Within 1-2 business days
- Merge: After approval and CI passes
Reviewers will check:
- Functionality: Does it work as intended?
- Tests: Are there adequate tests?
- Code Quality: Does it follow coding standards?
- Architecture: Does it fit the architecture?
- Documentation: Is it documented?
- Performance: Are there performance concerns?
- Security: Are there security implications?
- Read carefully: Understand the feedback
- Ask questions: If unclear, ask for clarification
- Make changes: Address the feedback
- Respond: Reply to comments explaining changes
- Request re-review: When ready
Example Response:
> Consider using a more descriptive variable name here.
Good point! Changed `x` to `backend_connector` for clarity.If your branch has conflicts with main:
# Update main
git checkout main
git pull upstream main
# Rebase your branch
git checkout feature/your-feature-name
git rebase main
# Resolve conflicts
# Edit conflicting files
git add .
git rebase --continue
# Force push (rebase rewrites history)
git push --force-with-lease origin feature/your-feature-nameFollow the project's coding standards (see AGENTS.md):
- PEP 8: Follow Python style guide
- Type Hints: Use type hints for all functions
- Docstrings: Document all public functions/classes
- Naming: Use descriptive names
- SOLID Principles: Follow SOLID design principles
- DRY: Don't Repeat Yourself
- Interface-Driven: Define interfaces before implementations
- Dependency Injection: Use DI for dependencies
- Immutable Models: Use immutable Pydantic models
- TDD: Write tests first
- Coverage: Aim for 80%+ coverage
- Unit Tests: Test components in isolation
- Integration Tests: Test component interactions
- Property Tests: Use Hypothesis for property-based testing
- Never log secrets: Don't print API keys or tokens
- Use redaction: Rely on global logging redaction
- Environment variables: Store keys in environment variables
- No hardcoding: Never hardcode keys in code
The project uses mandatory pre-commit hooks that:
- Scan for secrets: Detect API keys and tokens
- Block commits: Prevent commits with secrets
- Check architecture: Validate architectural constraints
Running manually:
./.venv/Scripts/python.exe dev/scripts/pre_commit_api_key_check.py- Use environment variables for sensitive data
- Keep
.envfiles untracked - Never commit credentials
- Rotate keys if leaked
- Audit CI logs for leaks
Update documentation when:
- Adding new features
- Changing existing behavior
- Fixing bugs that affect usage
- Adding configuration options
- Changing APIs
- README.md: High-level overview and quick start
- User Guide (
docs/user_guide/): Feature documentation - Development Guide (
docs/development_guide/): Developer documentation - Code Comments: Inline documentation
- Docstrings: Function/class documentation
- Clear and concise: Use simple language
- Examples: Provide code examples
- Complete: Cover all aspects
- Up-to-date: Keep in sync with code
- Formatted: Use proper Markdown formatting
- Create feature branch
- Write tests for the feature
- Implement the feature
- Update documentation
- Submit PR
- Create fix branch
- Write test that reproduces bug
- Fix the bug
- Verify test passes
- Submit PR with "Fixes #issue" in description
- Create docs branch
- Make documentation changes
- Preview changes locally
- Submit PR
See adding-backends.md for detailed guide.
# Run specific test
./.venv/Scripts/python.exe -m pytest tests/unit/test_file.py::test_name -v
# Run with debug output
./.venv/Scripts/python.exe -m pytest tests/unit/test_file.py -s
# Run with pdb debugger
./.venv/Scripts/python.exe -m pytest tests/unit/test_file.py --pdb# Run hook manually
./.venv/Scripts/python.exe dev/scripts/pre-commit-hook.py
# Check for secrets
./.venv/Scripts/python.exe dev/scripts/pre_commit_api_key_check.py
# Reinstall hooks
./.venv/Scripts/python.exe dev/scripts/install-hooks.py# Reinstall package
./.venv/Scripts/python.exe -m pip install -e .[dev]
# Verify installation
./.venv/Scripts/python.exe -c "import src; print(src.__file__)"- Documentation: Read the docs in
docs/ - Issues: Search existing issues on GitHub
- Discussions: Use GitHub Discussions for questions
- Code: Read the source code and tests
When asking for help:
- Search first: Check if question already answered
- Be specific: Provide details and context
- Include code: Share relevant code snippets
- Show effort: Explain what you've tried
- Be patient: Wait for responses
When reporting bugs:
- Search first: Check if bug already reported
- Minimal reproduction: Provide minimal example
- Environment: Include Python version, OS, etc.
- Expected vs actual: Describe expected and actual behavior
- Logs: Include relevant logs or error messages
- Be respectful: Treat everyone with respect
- Be constructive: Provide helpful feedback
- Be patient: Everyone is learning
- Be collaborative: Work together
- Follow Code of Conduct: Adhere to project's code of conduct
- Architecture: See architecture.md for system architecture
- Code Organization: See code-organization.md for project structure
- Building: See building.md for build instructions
- Testing: See testing.md for testing guidelines
- Adding Features: See adding-features.md for feature development
- Adding Backends: See adding-backends.md for backend development
- Coding Standards: See AGENTS.md for detailed coding standards