diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index c66ab3e61..94486046f 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -23,6 +23,15 @@ GitHub, clone, and develop on a branch. Steps: $ cd POT ``` +2. Install pre-commit hooks to ensure that your code is properly formatted: + + ```bash + $ pip install pre-commit + $ pre-commit install + ``` + + This will install the pre-commit hooks that will run on every commit. If the hooks fail, the commit will be aborted. + 3. Create a ``feature`` branch to hold your development changes: ```bash @@ -56,7 +65,7 @@ Pull Request Checklist We recommended that your contribution complies with the following rules before you submit a pull request: -- Follow the PEP8 Guidelines. +- Follow the PEP8 Guidelines which should be handles automatically by pre-commit. - If your pull request addresses an issue, please use the pull request title to describe the issue and mention the issue number in the pull request description. This will make sure a link back to the original issue is @@ -101,27 +110,19 @@ following rules before you submit a pull request: You can also check for common programming errors with the following tools: - -- No pyflakes warnings, check with: +- All lint checks pass. You can run the following command to check: ```bash - $ pip install pyflakes - $ pyflakes path/to/module.py + $ pre-commit run --all-files ``` -- No PEP8 warnings, check with: + This will run the pre-commit checks on all files in the repository. - ```bash - $ pip install pep8 - $ pep8 path/to/module.py - ``` - -- AutoPEP8 can help you fix some of the easy redundant errors: +- All tests pass. You can run the following command to check: ```bash - $ pip install autopep8 - $ autopep8 path/to/pep8.py - ``` + $ pytest --durations=20 -v test/ --doctest-modules + ``` Bonus points for contributions that include a performance analysis with a benchmark script and profiling output (please report on the mailing diff --git a/RELEASES.md b/RELEASES.md index 821432548..d56f9aaa8 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -6,6 +6,7 @@ - Custom functions provided as parameter `line_search` to `ot.optim.generic_conditional_gradient` must now have the signature `line_search(cost, G, deltaG, Mi, cost_G, df_G, **kwargs)`, adding as input `df_G` the gradient of the regularizer evaluated at the transport plan `G`. This change aims at improving speed of solvers having quadratic polynomial functions as regularizer such as the Gromov-Wassertein loss (PR #663). #### New features +- New linter based on pre-commit using ruff, codespell and yamllint (PR #681) - Added feature `mass=True` for `nx.kl_div` (PR #654) - Implemented Gaussian Mixture Model OT `ot.gmm` (PR #649) - Added feature `semirelaxed_fgw_barycenters` and generic FGW-related barycenter updates `update_barycenter_structure` and `update_barycenter_feature` (PR #659)