Personal template for machine learning (and more).
MIT License
Disclaimer: Even if it is a personal project, everybody can use it freely and modify it for their own needs.
This repository is a template for using in ML projects. It includes:
pytest-cov
to check unit tests and get coverage (including an optionalruff
to check the style and auto-format it, including:
pycodestyle
and flake
to check overall Python scripts style (PEP8)isort
to check the import order of Python scriptspydocstyle
to check Python docstrings style (Numpy convention)pylint
to have an overall grade of the style (including an optional minimumblack
to auto-format Python scriptsmypy
to check typing and type hintsSome GitHub actions 🏭 are provided:
bandit
for securityflake8
, mypy
, pydocstyle
, pylint
, ruff
for styleAnd finally, some badges:
All workflows create a badge available, for instance, in README.
This repository provides also a pre-commit configuration to check end-of-file, trailing whitespace, flake8 and pydocstyle (numpy).
All feature of this template is easy to adapt on your project by changing names
or versions on the .github/workflows/
directory and on the badge paths on your
markdown/rst files. All the worflows are independent and can be used individually.
You can also remove any workflow you don't need.
Before all, you need to create a gist The id of the gist is required for pylint and test/coverage badges. Then, you must add a secret in your repository (Settings > Secrets > New repository secret) that is a personal token with gist scope with name GIST_SECRET (details here).
By default, there is no maximum unit test coverage but you can set the minimum
coverage you want in utils/github_actions/pytest_manager.py
. There is also a
minimum grade for pylint that is 7.0/10 and can be set in
utils/github_actions/pylint_manager.py
. Details of pylint options are in
.pylintrc
and can also be changed at will.
Even if it is a personal template, feel free to contribute via issues or pull requests 🤗.
See CONTRIBUTING.md for more details.