Contributing
Adding an optimizer
Create
src/opt/<category>/<file_stem>.pywith one class that inherits fromAbstractOptimizer(see Abstract Optimizer) and export it from the category's__init__.pyand fromopt/__init__.py.Write the class docstring in Google style with the sections the validator expects: Algorithm Metadata (name, acronym, year, authors), Mathematical Formulation, Hyperparameters, COCO/BBOB Benchmark Settings, Args, Attributes, Example, References and See Also. Look at
whale_optimization_algorithm.pyfor a complete one.Record history with
self._record_history(...)in the loop and callself._finalize_history()beforesearch()returns.Regenerate the documentation and commit the result:
bashuv run python scripts/generate_docs.py --all --json --sidebar uvx --from repo-release-tools rrt artifacts --snapshot
Naming rules
| Thing | Rule | Example |
|---|---|---|
| Docs URL | file stem with _ as - | whale_optimization_algorithm.py → /algorithms/swarm-intelligence/whale-optimization-algorithm |
| Page title | Algorithm Name in the metadata table | Whale Optimization Algorithm |
| Acronym | Acronym in the metadata table, unique across the package | WOA |
The page, JSON entry and sidebar link of every optimizer come from these three rules, and scripts/test/test_docs_consistency.py fails if they drift apart.
Checks
uv run pytest src/opt/test/ scripts/test/ # unit tests and docs consistency
uv run pytest --doctest-modules src/opt # doctests
uv run ruff check src/opt/ && uv run ruff format --check src/opt/
cd docs && npm ci && npm run docs:build # fails on dead linksCommit subjects follow Conventional Commits; the release policy workflow checks them, the generated-file fingerprints and the version targets.