There are many ways in which you can contribute to the ongoing development of this project. For example, you can:
- Report a bug.
- Discuss the current state of the code.
- Submit a bugfix.
- Propose a new feature.
- Become a maintainer.
You have two ways for asking questions or reporting a bug or discussing the current state of the code (feedback is more than welcome).
-
If you are less familiar with GitHub, you can still write us using the Google Group dedicated to Clinica.
If this is your first time contributing to an open source project, please read this very clear tutorial. You will find how to fork this project, clone your fork, make a branch, add modifications and create a pull request using the command line or GUI tools.
To sum up these steps:
-
Go to the repository and click the "Fork" button to create your own copy of the project.
-
Clone the project to your local computer:
git clone git@github.com:<username>/clinica.git
where <username>
is your GitHub username.
- Create a branch for the feature you want to work on. Since the branch name will appear on the pull request, use a meaningful name:
git checkout -b <branch_name>
(e.g. git checkout -b fix_something_important
)
-
Commit locally as you progress (
git add
andgit commit
) -
To push your changes to your fork on GitHub, type:
git push origin <branch_name>
-
Go to GitHub. The new branch will show up with a green Pull Request button. Simply click it.
-
Your pull request will be under review. A friendly discussion with the reviewer(s) will be done in order to improve the quality of your contribution if needed. If so, update your pull request until your changes are pushed up. The pull request will update automatically and will finally be merged by the reviewer(s).
Note: In order to normalize code style across Clinica, we use the Black code
formatter. A nice idea is to use it in
combination of a pre-commit hook. Please see instructions
here about how to install the precommit hook in your
local copy (shortly: run pre-commit install
inside the cloned folder).
If you plan to contribute regularly to Clinica, you have to synchronize your fork regularly with the main repository. This can be done by following these steps:
-
Add the main Clinica repository to your remote:
git remote add upstream https://github.com/aramis-lab/clinica.git
upstream
is an arbitrary name, you can call it whatever you want, but upstream is a convention. -
Get the data associated with the remote (it will only download it and do nothing else):
git fetch upstream
-
Let's say you want the latest version of the
dev
branch. Go to your own dev branch, then pull from theupstream
remote:git checkout dev git pull upstream dev
Now the dev
branch of your own fork is up to date with aramislab/clinica
dev.
It may happen that your pull request has conflicts (your feature branch tries
to modify the same portion of code as a recently made commit on the dev
branch). You must integrate the latest commit of dev
into your feature branch.
One way of doing it would be to merge upstream/dev
directly into your feature
branch. We will rather rebase it, so that our git history in Clinica can keep a
linear history.
-
Go to your feature branch, and perform an interactive rebasing:
git checkout newfeature git rebase -i upstream/dev
Keep only the commits that must be applied, corresponding to
newfeature
, at the top ofupstream/dev
(more information here).The conflict will appear once you validate the rebasing.
-
Solve the conflicts, following git instructions.
-
Once it is done, you can force push (because you have rewritten history):
git push --force
or
git push --force origin newfeature
Now your Pull Request does not have conflicts anymore!
There is no fully-defined policy for integrating a PR into the main code, i.e., a PR can be "merged", "squashed and merged" or "rebased and merged", depending on the nature of the PR and the organization of the commits in your fork. For example, a PR that fixes a typo will be integrated by "squash and merge" while a PR proposing a new pipeline will probably be integrated by "rebase and merge". In this case we would like to keep intermediate commit messages (if we consider them important for the project).
For Python files, we use Google Python Style
Guide for docstrings. The PEP
8 convention is used but some rules
are ignored (they are listed in the .pep8speaks.yml
configuration
file.
Recently, we start using Black code formatter. Please, be sure that you run it before commiting your new code. To automatically do it, you can install a pre-commit hook, as described above.
For Markdown files, currently we don't have a consistent style (but try to keep line length under 80 characters :)).
Clinica uses private data for both converters and pipelines. However, Jenkins logs are public so you can see the behaviour of Clinica tests on PR.
This project uses the MkDocs tool with the Material theme and extra plugins to generate the documentation.
A folder named docs
contains all the files to build the documentation. These
files are written in Markdown format. The documentation is built automatically for
each PR. You can preview the output for your PR by replacing and copying this
URL in your browser:
https://aramislab.paris.inria.fr/clinica/docs/public/<your-PR-ID>
By contributing to Clinica, you agree that your contributions will be licensed under its License.