Contributing to OptiFlowX
Thanks for your interest in contributing! This document describes how to propose changes, add new optimizers, run tests, and keep the documentation up to date.
Quick startโ
- Fork the repository and create a descriptive branch for your work:
git clone https://github.com/Faycal214/optiflowx.git
cd optiflowx
git checkout -b feat/short-description
- Keep changes focused and add tests for any new behavior.
Project layout (top-level)โ
optiflowx/โ Python package (core modules)optiflowx/optimizers/โ optimizer implementations (GA, PSO, TPE, etc.)optiflowx/models/configs/โ model configs and wrappersexamples/โ runnable examples for common workflowsdocs/โ MkDocs documentation (source used for site)tests/โ unit and integration tests
Coding guidelinesโ
- Use
blackfor formatting andrufffor linting. These are used in CI. - Add clear docstrings for new public APIs.
- Keep commits small and focused; update docs and examples when public behavior changes.
Adding a new optimizerโ
- Create a new file under
optiflowx/optimizers/(for examplemy_optimizer.py). - Implement a class that accepts at minimum:
search_space,metricorcustom_metric,model_class,X,yand exposes arun(max_iters=...)method returning(best_params, best_score). - Provide a short example in
examples/and add unit tests undertests/demonstrating basic usage (use small sklearn datasets).
Example skeleton:
class MyOptimizer:
def __init__(self, search_space, metric, model_class, X, y, **kwargs):
...
def run(self, max_iters=10):
return best_params, best_score
Documentationโ
- Update or add docs under
docs/when you introduce new features. - The documentation site is built with Docusaurus and lives in the
website/folder.
To preview the documentation locally (from the repository root):
cd website
npm install
npm run start
To build a production-ready static site:
cd website
npm run build
Testsโ
Install test dependencies and run the suite:
pip install -r requirements-test.txt
pytest -q
- Aim to write deterministic tests. If randomness is involved, set seeds in tests.
Pull request checklistโ
- Branch from
mainand rebase/merge latest changes before opening a PR. - Add or update tests for new behaviors.
- Update documentation and examples when the public API or semantics change.
- Run
blackandrufflocally and ensure no linting errors. - Provide a clear PR description and link related issues.
If you are unsure about design, open an issue to discuss before implementing large changes. Maintainers are happy to help scope features and offer suggestions.
Thank you for improving OptiFlowX!
Contributing to OptiFlowX
Folder structureโ
optiflowx/ core/ optimizers/ models/ configs/ wrappers/ tests/ docs/
Adding a new optimizerโ
- Create a new file in
optiflowx/optimizers/. - Follow the structure of existing optimizers (
genetic.py,pso.py, etc.). - Implement a
.run(max_iters)method returning(best_params, best_score).
Testingโ
Use pytest:
pytest -q