Contributing to PyRADE
We welcome contributions! This guide will help you get started.
Development Setup
Fork and clone the repository:
git clone https://github.com/yourusername/pyrade.git
cd pyrade
Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
Install in development mode:
pip install -e ".[dev]"
Code Style
We use:
black for code formatting
flake8 for linting
mypy for type checking
Format your code:
black pyrade/
flake8 pyrade/
mypy pyrade/
Testing
Run tests:
pytest tests/
pytest tests/ --cov=pyrade # With coverage
Adding New Features
Adding a Mutation Strategy
Create your strategy in
pyrade/operators/mutation.py:
class MyMutation(MutationStrategy):
def __init__(self, F=0.8):
self.F = F
def apply(self, population, fitness, best_idx, target_indices):
# Your implementation
# Must return mutants array
pass
Add tests in
tests/test_mutation.pyUpdate documentation in
docs/api_reference.mdAdd example usage
Adding a Benchmark Function
Add to
pyrade/benchmarks/functions.py:
class MyFunction(BenchmarkFunction):
def __init__(self, dim=30):
super().__init__(dim)
self.bounds = (-10, 10)
self.optimum = 0.0
self.optimum_location = np.zeros(dim)
def __call__(self, x):
# Your implementation
pass
Add tests and documentation
Pull Request Process
Create a feature branch:
git checkout -b feature/my-feature
Make your changes and commit:
git add .
git commit -m "feat: Add my feature"
Push and create PR:
git push origin feature/my-feature
Ensure:
All tests pass
Code is formatted
Documentation is updated
PR description is clear
Commit Message Format
Use conventional commits:
feat:New featurefix:Bug fixdocs:Documentation changestest:Adding testsrefactor:Code refactoringperf:Performance improvementschore:Maintenance tasks
Questions?
Open an issue on GitHub
Email: arartawil@gmail.com
See also: Code of Conduct