Here is a brief outline for the development goal in terms of code, readability, and maintainability.
The code style is enforced using pre-commit hooks that are run in the GitLab CI pipeline. It will check and format Python source files using the following code-style checkers and formatters
In addition, it will check and fix other file types for trailing whitespaces and more. These code-style checkers and formatters are used to make the code-base look uniform and check that it is PEP8 compliant. Note that the line-length limit is set to 118 characters even though PEP8 recommends 79.
The pre-commit hooks are set up locally by running the following two commands in the root of the Dalton Project directory:
$ pip install pre-commit
$ pre-commit install
During a git commit, if any pre-commit hook fails, mostly you will simply need to git add the affected files and git commit again, because most tools will automatically reformat the files. Staged files can also be checked before committing by running:
$ pre-commit run
Again, if a step fails the tools will in most cases also reformat the files that caused the failure. You will therefore need to stage those files again (git add) and they are then ready to git commit.
If you want to run pre-commit on all files this can be done with the following command:
$ pre-commit run --all-files
Continuous Integration and Code Coverage
The Dalton Project uses continuous integration through GitLab CI and code coverage through codecov.io.
The test suite for Dalton Project can be run locally using:
$ pytest tests/*
The requirements for the testing suite can be installed by:
$ pip install [--user] -r tests/requirements.txt
The documentation can be generated locally by running the following command:
$ sphinx-build docs local_docs
Requirements for the documentation can be installed as:
$ pip install [--user] -r docs/requirements.txt