How to contribute (WIP) - kutaslab/fitgrid GitHub Wiki
This tutorial assumes that you are familiar with Python, git, github, and conda. If any of the following is not making sense, please post an issue with your question/suggestion.
Prerequisites
- a Linux machine
git
conda
Setup
-
Clone the latest fitgrid development branch from github:
git clone --branch dev --single-branch https://github.com/kutaslab/fitgrid.git/dev
-
Checkout a new working branch (but call it something sensible, not
new-branch
).git checkout -b new-branch
-
Create and activate a conda development environment, it will likely take a while to install all the latest fitgrid dependencies.
conda create -n fitgrid_compat -c kutaslab/label/pre-release -c defaults -c conda-forge -c ejolly -y conda activate fitgrid_compat
-
Install
fitgrid
in development mode soimport fitgrid
imports the changes you make to the source:pip install -e .
Making changes
-
If you are working on a new feature or fixing a bug, add tests that will pass when the feature is added or the bug is fixed.
-
Make your changes.
-
Run
pytest
regularly as you are iterating on your feature/bugfix. -
fitgrid
uses a code formatter called Black to enforce a uniform code style. Install it if you don't have it:conda install black
We use the draconian convention of a maximum line length of 79, so run the following to format your code accordingly:
black -S --line-length=79 .
-S
is there to allow both single quotes and double quotes for strings. -
Make sure all tests pass and your code is formatted appropriately. You are almost ready to submit your changes. While you've been working on your branch, someone might have merged something into dev, so you need to ensure you are up-to-date:
git checkout dev git pull git checkout - # switch back to your branch git rebase dev
-
Assuming the previous step didn't fail, you are now ready to submit your changes and push your branch to the repo:
git push --set-upstream origin new-branch
where
new-branch
is the name of your branch. -
Check the Actions tab on https://github.com/kutaslab/fitgrid/actions and make sure your new branch is passing all the Actions tests.
-
If all Actions pass, use the the GitHub interface, and make a pull request to dev.