diff --git a/.gitlab-ci/default.yml b/.gitlab-ci/default.yml index 012847136f8409bed2566eb1e896a7a229fa814c..db7ffd2359f915b5caaedf1dd377594828cef91b 100644 --- a/.gitlab-ci/default.yml +++ b/.gitlab-ci/default.yml @@ -3,6 +3,7 @@ default: stages: + - linting - configure - select - build @@ -30,6 +31,14 @@ configure: - build-cmake expire_in: 3 hours +python linting: + stage: linting + image: registry.gitlab.com/pipeline-components/black:latest + script: + # only check the python folder for now (Python code related to bindings) + # TODO: maybe extend this to the utility scripts? + - black --check --verbose -- python + select tests: stage: select diff --git a/python/README.md b/python/README.md index 851ef4e6fb803e4b9a424e1666b9f782935c8181..ea6f6044b483f78c30b089ddb294d1fbfe5b7a97 100644 --- a/python/README.md +++ b/python/README.md @@ -69,3 +69,14 @@ You can run all currently existing DuMu<sup>x</sup> Python tests with cd dumux/build-cmake ctest -L python ``` +## Development + +All Python files should be linted by the tool [`black`](https://pypi.org/project/black/). +You can install `black` with `pip install black` and run it from the dumux top-directory + +``` +black ./python +``` + +You can also run it on a specific file (replace `./python` by file name) +This will automatically format the Python files. Run black before every commit changing Python files.