Contributing
We welcome contributions to SpecAlign! This guide will help you get started.
Getting Started
Fork the repository on GitHub
Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/specalign.git cd specalign
Install development dependencies:
pip install -e ".[dev]"
Create a branch for your changes:
git checkout -b feature/your-feature-name
Development Setup
Run Tests
pytest tests/
pytest tests/ -v --cov=specalign
Code Formatting
We use ruff for linting and formatting:
ruff check src/
ruff format src/
Type Checking
mypy src/specalign
Build Documentation
cd docs
pip install -r requirements.txt
sphinx-build -b html . _build/html
Contribution Guidelines
Code Style
Follow PEP 8 guidelines
Use type hints for function signatures
Write docstrings for public functions and classes
Keep functions focused and single-purpose
Commit Messages
Use clear, descriptive commit messages:
Add feature: context pool diversity scoring
- Implement MMR-based retrieval for diverse examples
- Add diversity_weight configuration option
- Update documentation with new feature
Pull Requests
Ensure all tests pass
Update documentation if needed
Add tests for new functionality
Keep PRs focused on a single change
Reference related issues in the PR description
Testing
Write unit tests for new functionality
Maintain test coverage above 80%
Use pytest fixtures for common setup
Test edge cases and error conditions
Areas for Contribution
We especially welcome contributions in these areas:
New attack strategies: Implement novel adversarial techniques
Provider integrations: Add support for new API providers
Evaluation metrics: New ways to measure attack/defense quality
Documentation: Tutorials, examples, and guides
Bug fixes: Help us squash bugs!
Reporting Issues
When reporting issues, please include:
SpecAlign version (
specalign --version)Python version
Operating system
Steps to reproduce
Expected vs actual behavior
Relevant logs or error messages
Code of Conduct
Be respectful and inclusive
Focus on constructive feedback
Help others learn and grow
Follow project maintainer decisions
Thank You!
Thank you for contributing to SpecAlign! Your efforts help make AI systems safer and more aligned.