Skip to content

Latest commit

 

History

History
81 lines (55 loc) · 2.6 KB

CONTRIBUTING.md

File metadata and controls

81 lines (55 loc) · 2.6 KB

Contributing to GWSumm

This is @alurban's and @duncanmmacleod's workflow, which might work well for others. It is merely a verbose version of the GitHub flow.

The basic idea is to use the master branch of your fork as a way of updating your fork with other people's changes that have been merged into the main repo, and then working on a dedicated feature branch for each piece of work:

  • create the fork (if needed) by clicking Fork in the upper-right corner of https://github.com/gwpy/gwsumm/ - this only needs to be done once, ever

  • clone the fork into a new folder dedicated for this piece of work (replace <username> with yout GitHub username):

    git clone https://github.com/<username>/gwsumm.git gwsumm-my-work  # change gwsumm-my-work as appropriate
    cd gwsumm-my-work
  • link the fork to the upstream 'main' repo:

    git remote add upstream https://github.com/gwpy/gwsumm.git
  • pull changes from the upstream 'main' repo onto your fork's master branch to pick up other people's changes, then push to your remote to update your fork on github.com

    git pull --rebase upstream master
    git push
  • create a new branch on which to work

    git checkout -b my-new-branch
  • make commits to that branch

  • push changes to your remote on github.com

    git push -u origin my-new-branch
  • open a merge request on github.com

  • when the request is merged, you should 'delete the source branch' (there's a button), then just delete the clone of your fork and forget about it

 cd ../
 rm -rf ./gwsumm-my-work

And that's it.

Coding guidelines

Python compatibility

GWSumm code must be compatible with Python versions >=3.6.

Style

This package follows PEP 8, and all code should adhere to that as far as is reasonable.

The first stage in the automated testing of pull requests is a job that runs the flake8 linter, which checks the style of code in the repo. You can run this locally before committing changes via:

python -m flake8

Testing

GWSumm has a relatively incomplete test suite, covering less than 40% of the codebase. All code contributions should be accompanied by (unit) tests to be executed with pytest, and should cover all new or modified lines.

You can run the test suite locally from the root of the repository via:

python -m pytest gwsumm/