Consistency makes code more readable and easier for collaborators to jump in. SimPEG uses Black to autoformat its codebase, and flake8 to lint its code and enforce style rules. Black can automatically format SimPEG’s codebase to ensure it complies with Black code style. flake8 performs style checks, raises warnings on code that could lead towards bugs, performs checks on consistent documentation formatting, and identifies poor coding practices.
If you configure pre-commit, it will automatically run Black and flake8 on every commit.
black SimPEG examples tutorials tests
flake8 on the whole project with:
Following code style rules can be challenging for new contributors. These rules are meant to ease the development process, not to generate an obstacle to contribute. Please, don’t hesistate to ask for help if your contribution raises some flake8 errors. And feel free to push code that don’t follow our code style 100% in Pull Requests. Other developers will be there to help you solve them.
SimPEG is currently not PEP 8 compliant and is not following all flake8 rules, but we are working towards it and would appreciate contributions that do too!