Contributingο
Contributing to LightWinο
If you implement your own :class:.OptimisationAlgorithm or add support for some :class:.Element, we encourage you to integrate your work in LightWin source code.
π Development Workflowο
We use long-lived branches for each major series (e.g., 1.7.x).
TL;DRο
Base your work on the relevant
X.Y.xbranchRun
pre-commithooks before committingRun and write tests
Submit a pull request
π§ͺ Running Testsο
The project uses pytest.
From the root of the repository:
pytest -m "not implementation"
You will need to install development dependencies:
pip install lightwin -e ".[test]"
π― Pre-commit Hooksο
We use pre-commit to enforce formatting and static checks.
It should be automatically installed when running pip install lightwin.
Set it up as follows:
pre-commit install
This ensures that all required hooks run automatically before each commit.
Hook configurationο
The repository uses the following hooks:
black(code formatting)isort(import sorting)pyupgrade(modernize Python syntax)Various
pre-commit-hookslike:check-docstring-firstcheck-merge-conflictend-of-file-fixertrailing-whitespaceand many more
The full configuration is in .pre-commit-config.yaml.
To run all hooks manually:
pre-commit run --all-files
β¨ Contributing Codeο
Fork the repository and clone your fork.
Create a branch from the appropriate
X.Y.xbranch:git checkout -b fix/some-bug 1.7.x
Make your changes.
Ensure pre-commit hooks pass.
Add tests if applicable.
Commit and push:
git commit -m "Fix: correct bug in XYZ" git push origin fix/some-bug
Open a pull request into the corresponding
X.Y.xbranch.
π§Ύ Changelog and Versioningο
Please add an entry to CHANGELOG.md under the appropriate unreleased version header:
## [X.Y.Z]
We use Semantic Versioning: MAJOR.MINOR.PATCH.
π£ Questions or Suggestions?ο
Open an issue or start a discussion. Weβre happy to help!
Thank you again for contributing π
β Adrien