Contributing Guide¶
Currently, no contributions will be accepted. What follows is an example of the final version.
Thank you for your interest in contributing to the AI Assistant project! This guide will help you get started with contributing code, documentation, and ideas.
๐ฏ How to Contribute¶
Types of Contributions¶
- Code: Bug fixes, new features, performance improvements
- Documentation: Tutorials, API docs, architecture guides
- Testing: New test cases, test infrastructure improvements
- Tools: New tool integrations, tool improvements
- Examples: Usage examples, integration guides
๐ Contribution Process¶
1. Pre-Contribution Checklist¶
- [ ] Read this contributing guide
- [ ] Check existing issues and pull requests
- [ ] Ensure you have Astral UV installed
- [ ] Set up the development environment
2. Development Setup¶
# Fork and clone the repository
git clone https://github.com/jSieber7/ai_assistant.git
cd ai_assistant
# Set up development environment
cp .env.template .env
uv venv .venv
uv sync --dev
3. Making Changes¶
# Create a feature branch
git checkout -b feature/your-feature-name
# Make your changes
# Test your changes
uv run run_tests.py --coverage
# Format and lint your code
uv run black .
uv run ruff check .
uv run mypy app/
4. Submitting Changes¶
# Commit with descriptive message
git add .
git commit -m "feat: add new tool integration"
# Push to your fork
git push origin feature/your-feature-name
# Create a pull request on GitHub
๐๏ธ Code Standards¶
Python Code Style¶
- Follow code formatting guidelines of black, ruff, and mypy
- Use type hints for all function parameters and returns
- Write docstrings for all public functions and classes
- Use descriptive variable and function names
Code Quality Tools¶
The project uses several automated tools:
# Format code (automatically fixes style issues)
uv run black .
# Check code style
uv run ruff check .
# Type checking
uv run mypy app/
# Security scanning
uv run bandit -r app/
uv run pip-audit
Testing Requirements¶
- Write tests for all new functionality
- Maintain or improve test coverage
- Include both unit tests and integration tests
- Test edge cases and error conditions
๐ Documentation Standards¶
API Documentation¶
- Update API documentation for new endpoints
- Include request/response examples
- Document error conditions and status codes
Tool Documentation¶
- Document new tools with usage examples
- Include configuration instructions
- Provide troubleshooting guides
Architecture Documentation¶
- Update architecture diagrams for significant changes
- Document design decisions and trade-offs
๐ง Development Workflow¶
Branch Naming Convention¶
feature/feature-name
: New featuresfix/bug-description
: Bug fixesdocs/documentation-topic
: Documentation improvementsrefactor/component-name
: Code refactoring
Commit Message Format¶
type: description
[optional body]
[optional footer]
Types: - feat
: New feature - fix
: Bug fix - docs
: Documentation changes - style
: Code style changes (formatting, etc.) - refactor
: Code refactoring - test
: Adding or modifying tests - chore
: Maintenance tasks
Examples:
feat: add web search tool integration
- Implement SearX integration
- Add tool selection logic
- Include error handling
Closes #123
Pull Request Guidelines¶
Before submitting a PR: - [ ] Tests pass locally - [ ] Code follows style guidelines - [ ] Documentation is updated - [ ] Branch is up to date with main - [ ] Commit messages follow convention
PR Description Template:
## Description
Brief description of the changes
## Changes Made
- Change 1
- Change 2
- Change 3
## Testing
- [ ] Unit tests added/updated
- [ ] Integration tests pass
- [ ] Manual testing performed
## Related Issues
Closes #123, Fixes #456
## Screenshots (if applicable)
๐งช Testing Guidelines¶
Writing Tests¶
def test_new_feature():
"""Test descriptive name for the test."""
# Arrange - set up test conditions
test_input = "test data"
# Act - perform the action being tested
result = function_under_test(test_input)
# Assert - verify the outcome
assert result == expected_output
@pytest.mark.asyncio
async def test_async_feature():
"""Test async functionality."""
result = await async_function()
assert result is not None
Test Structure¶
- Unit tests: Test individual components in isolation
- Integration tests: Test interactions between components
- Performance tests: Test response times and resource usage
- Error handling tests: Test failure scenarios
Running Tests¶
# Run all tests
python run_tests.py
# Run with coverage
python run_tests.py --coverage
# Run specific test types
python run_tests.py --unit
python run_tests.py --integration
# Run tests in parallel
python run_tests.py --parallel
๐ Security Considerations¶
Secure Development Practices¶
- Never hardcode API keys or secrets
- Validate all user input
- Use environment variables for configuration
- Follow principle of least privilege
Security Testing¶
- Run security scans before submitting PRs
- Test for common vulnerabilities (SQL injection, XSS, etc.)
- Verify authentication and authorization logic
๐ Feature Development¶
Adding New Tools¶
- Design the tool interface
- Implement the tool functionality
- Write comprehensive tests
- Document the tool usage
- Integrate with the agent system
Adding API Endpoints¶
- Design the endpoint specification
- Implement the route handler
- Add request/response models
- Write endpoint tests
- Update API documentation
Performance Considerations¶
- Optimize for low latency
- Use async/await for I/O operations
- Implement caching where appropriate
- Monitor resource usage
๐ค Community Guidelines¶
Communication¶
- Be respectful
- Provide constructive feedback
- Assume good intentions
- Help others learn and grow
Issue Reporting¶
When reporting issues, include: - Description: What happened vs. what you expected - Steps to reproduce: Clear reproduction steps - Environment: OS, Python version, dependencies - Logs: Relevant error messages and logs
Asking for Help¶
- Search existing issues and documentation first
- Provide context and what you've tried
- Be specific about what you need help with
๐ Code Review Process¶
Review Guidelines¶
- Focus on code quality and functionality
- Check for security issues
- Verify tests are adequate
- Ensure documentation is updated
- Suggest improvements constructively
Review Response¶
- Address all review comments
- Explain your design decisions if needed
- Make requested changes or discuss alternatives
- Thank reviewers for their time
๐ Recognition¶
Contributor Recognition¶
- Contributors are credited in the README
- Significant contributions are highlighted in release notes
- All contributors are appreciated and valued
Becoming a Maintainer¶
Consistent, high-quality contributors may be invited to become maintainers. Maintainers have additional responsibilities: - Review and merge pull requests - Triage issues - Help guide project direction - Mentor new contributors
โ Getting Help¶
Resources¶
Contact¶
- Create a GitHub issue for bug reports and feature requests
- Use GitHub discussions for questions and ideas
- Follow the project for updates and announcements
๐ License¶
By contributing, you agree that your contributions will be licensed under the project's open source license.
๐ Thank You!¶
Thank you for considering contributing to the AI Assistant project. Your contributions help make this project better for everyone. We appreciate your time, effort, and expertise.
Happy coding! ๐