Contributing

Note

These guidelines are copied from Aerie’s contributing guidelines.

We would love for you to contribute to pymerlin and help make it even better than it is today! As a contributor, here are the guidelines we would like you to follow:

Got a Question or Problem?

If you would like to chat about the question in real-time, you can reach out via the Aerie users Slack channel.

Building pymerlin

To build and develop pymerlin please read through the developer documentation.

Pull Request Guidelines

Here are some general Pull Request (PR) guidelines for the pymerlin project:

  • Every PR should include a summary of changes that gives reviewers an idea of what they should pay attention to.

  • PR branches should have as “clean” of a history as possible.

  • Each commit should present one change or idea to a reviewer.

  • Commits that merely “fix up” previous commits should be interactively rebased and squashed into their targets.

  • Prefer the use of git rebase over git merge:

    • git rebase actually rebases your branch from the current development branch’s endpoint. This localizes conflicts to the commits at which they actually appear, though it can become complicated when there are more than a few conflicts.

    • git merge pulls in all the updates that your branch does not have, and combines them with the updates you have made in a single merge commit. This allows you to deal with any and all conflicts at once, but information such as when conflicts originated is lost.

    For more info on git merge vs git rebase see here.

  • Before merging a PR, the following requirements must be met. These requirements ensure that history is effectively linear, which aids readability and makes git bisect more useful and easier to reason about.

    • At least one (preferably two) reviewers have approved the PR.

    • No outstanding review comments have been left unresolved.

    • The branch passes continuous integration.

    • The branch has been rebased onto the current develop branch.

  • The “Squash and merge” and “Rebase and merge” buttons on GitHub’s PR interface should not be used. Always use the “Merge” strategy.

    • In combination with the restrictions above, this ensures that features are neatly bracketed by merge commits on either side, making a clear hierarchical separation between features added to develop and the work that went into each feature.

Good Commit, PR, and Code Review Practices

The pymerlin project relies on the ability to effectively query the Git history. Please read through the following resources before contributing:

Submitting a Pull Request

Please follow these instructions when submitting a Pull Request:

  1. Search GitHub for an open or closed PR that relates to your submission. You don’t want to duplicate effort.

  2. Be sure that an issue describes the problem you’re fixing, or documents the design for the feature you’d like to add. Discussing the design up front helps to ensure that we’re ready to accept your work.

  3. Clone the pymerlin repo.

  4. Make your changes in a new git branch:

    git checkout develop
    git pull origin develop
    git checkout -b my-fix-branch develop
    
  5. Create your patch.

  6. Commit your changes using a descriptive commit message that follows our commit conventions.

    git commit -a
    

    Note: the optional commit -a command line option will automatically “add” and “rm” edited files.

  7. Push your branch to GitHub:

    git push origin my-fix-branch
    
  8. In GitHub, send a pull request to pymerlin:develop.

  9. If we suggest changes then:

  • Make the required updates.

  • Rebase your branch and force push to your branch to GitHub (this will update your Pull Request):

    git rebase develop -i
    git push -f
    

After your pull request is merged, you can safely delete your branch and pull the changes from the repository:

  • Check out the develop branch:

    git checkout develop
    
  • Update your develop with the latest version:

    git pull origin develop
    
  • Delete the local branch:

    git branch -D my-fix-branch