We welcome all contributions! Please head to issues to either file any bugs/feature requests or find a task you want to assist with. Make sure to assign yourself the task if you decide to work on it.
This package uses flake8
- it's settings are described in setup.cfg. The code in this package is also automatically formatted by black
for consistency.
-
See the Github docs for how to make a copy (a fork) of a repository to your own Github account.
-
Then, clone the repository to your local machine so you can begin making changes.
-
Add this repository as an upstream remote on your local git repository so that you are able to fetch the latest commits.
-
On your local machine make sure you have the latest version of the
develop
branch:git checkout develop git pull upstream develop
This will install all the dependencies of the package including the active branch of Genie
. We highly recommend that you leverage some form of python version management like pyenv or anaconda. There are two ways you can install the dependencies for this package.
This is the more traditional way of installing dependencies. Follow instructions here to learn how to install pip.
pip install -r requirements-dev.txt
pip install -r requirements.txt
pipenv
is a Python package manager. Learn more about pipenv and how to install it.
# Coming soon
The GENIE project follows the standard git flow development strategy.
To ensure the most fluid development, try not to push to your
develop
ormain
branch.
-
(Assuming you have followed all 4 steps above in the "fork and clone this repository" section). Navigate to your cloned repository on your computer/server.
-
Make sure your
develop
branch is up to date with theSage-Bionetworks/Genie
develop
branch.cd {your-github-username}/Genie git checkout develop git pull upstream develop
-
Create a feature branch which off the
develop
branch. If there is a GitHub/JIRA issue that you are addressing, name the branch after the issue with some more detail (like{GH|JIRA}-123-add-some-new-feature
).git checkout develop git checkout -b JIRA-123-new-feature
-
At this point, you have only created the branch locally, you need to push this to your fork on GitHub.
git push --set-upstream origin JIRA-123-new-feature
You should now be able to see the branch on GitHub. Make commits as you deem necessary. It helps to provide useful commit messages - a commit message saying 'Update' is a lot less helpful than saying 'Remove X parameter because it was unused'.
git commit changed_file.txt -m "Remove X parameter because it was unused" git push
-
(Make sure you have follow instructions in "Install development dependencies") Once you have made your additions or changes, make sure you write tests and run the test suite. More information on testing below.
pytest ./test
-
(Make sure you have follow instructions in "Install development dependencies") Make sure to run the auto python code formatter, black.
black ./
-
Once you have completed all the steps above, in Github, create a pull request from the feature branch of your fork to the
develop
branch of Sage-Bionetworks/Genie.
A code maintainer must review and accept your pull request. A code review ideally happens with both the contributor and the reviewer present, but is not strictly required for contributing. This can be performed remotely (e.g., Zoom, Hangout, or other video or phone conference).
This package uses semantic versioning for releasing new versions. The version should be updated on the develop
branch as changes are reviewed and merged in by a code maintainer. The version for the package is maintained in the genie/init.py file. A github release should also occur every time develop
is pushed into main
and it should match the version for the package.
Make sure to run each of the pipeline steps here on the test pipeline and verify that your pipeline runs as expected. This is not automatically run by Github Actions and have to be manually run.
This package uses pytest
to run tests. The test code is located in the tests subdirectory.
Here's how to run the test suite:
pytest -vs tests/
Tests in Python are also run automatically by Github Actions on any pull request and are required to pass before merging.
This package uses testthat
to run tests in R. The test code is located in the testthat subdirectory.
Here's how to run the test suite:
Rscript -e "testthat::test_dir('R/tests/testthat/')"
Please add tests for new code. These might include unit tests (to test specific functionality of code that was added to support fixing the bug or feature), integration tests (to test that the feature is usable - e.g., it should have complete the expected behavior as reported in the feature request or bug report), or both.
It is recommended to use the following style (see example below) for mock testing across this package:
from unittest.mock import patch
...
patch.object(MODULE_NAME, "FUNCTION_TO_MOCK_NAME".return_value=SOME_RETURN_VALUE)
Follow gitflow best practices as linked above.
- Always merge all new features into
develop
branch first (unless it is a documentation, readme, or github action patch intomain
) - After initial features are ready in the
develop
branch, create arelease-X.X
branch (do not need to push this branch to remote) to prepare for the release.- update the
__version__
parameter ingenie/__init__.py
- update the
- Merge
release-X.X
branch intomain
- Not by pull request! - Create release tag (
v...
) and a brief message - Push tag and change(s) from
main
- Create a new release on the repo. Include release notes. Also include any known bugs for each release here. Wait for the CI/CD to finish.
- Merge
main
back intodevelop
- Push
develop
Follow this section when modifying the Dockerfile:
- Have your synapse authentication token handy
docker build -f Dockerfile -t <some_docker_image_name> .
docker run --rm -it -e SYNAPSE_AUTH_TOKEN=$YOUR_SYNAPSE_TOKEN <some_docker_image_name>
- Run test code relevant to the dockerfile changes to make sure changes are present and working
- Once changes are tested, follow genie contributing guidelines for adding it to the repo
- Once deployed to main, make sure docker image was successfully deployed remotely (our docker image gets automatically deployed) here
This repository does not use github actions to push docker images. By adding the sagebiodockerhub
github user as an Admin to this GitHub repository, we can configure an automated build in DockerHub. You can view the builds here. To get admin access to the DockerHub repository, ask Sage IT to be added to the genieadmin
DockerHub team.