-
Notifications
You must be signed in to change notification settings - Fork 191
Development environment
Leopold Talirz edited this page Oct 29, 2019
·
22 revisions
- fork the aiida_core repository
-
git clone
your fork to have a local copy. - Check out the right branch and create a new one for your development:
git checkout develop
git checkout -b my-new-addition
The AiiDA pre-commit hooks help you write clean code by running
- code formatting
- syntax checking
- static analysis
- checks for missing docstrings
- checks for consistency of dependencies and version numbers
- ...
locally at every commit you make. We currently use yapf and prospector, but more tools may follow.
Set up the hooks as follows:
cd aiida-core pip install -e .[dev_precommit] pre-commit install pre-commit run # test running the hooks # from now on, hooks will check the *changed* files on every commit
Note:
- If you work in a
conda
environment, you may need toconda install virtualenv
to avoid problems with virtualenv inside conda. - On Ubuntu-18.04 you may need to
sudo apt install ruby-dev
- Use
pre-commit run
to run the checks without committing - If you ever need to commit a 'work in progress' you may skip the checks via
git commit --no-verify
. Yet, keep in mind that the pre-commit hooks will also run (and fail) at the continuous integration stage when you push them upstream. - For historical reasons, some code files are excluded from pre-commit checks in aiida. When touching such a file, please try to remove them from the exclude list
.pre-commit-config.yaml
.
- In some cases of very long strings, yapf will not be able to split the string and then prospector will complain. In this case just split the string manually. See discussion in #2114.