Pull request step-by-step#

The preferred workflow for contributing to PyMC is to fork theGitHub repository, clone it to your local machine, and develop on a feature branch.

Steps#

  1. Read theEtiquette for code contributions.

  2. Fork theproject repository by clicking on the ‘Fork’ button near the top right of the main repository page. This creates a copy of the code under your GitHub user account.

  3. Clone your fork of the PyMC repo from your GitHub account to your local disk, and add the base repository as a remote:

    gitclonegit@github.com:<yourGitHubhandle>/pymc.gitcdpymcgitremoteaddupstreamgit@github.com:pymc-devs/pymc.git
  4. Create afeature branch to hold your development changes:

    gitcheckout-bmy-feature

    Attention

    Always use afeature branch. It’s good practice to never routinely work on themain branch of any repository.

  5. Project requirements are inrequirements.txt, and libraries used for development are inrequirements-dev.txt.The easiest (and recommended) way to set up a development environment is viaminiconda:

    condaenvcreate-fconda-envs/environment-dev.yml
    condaenvcreate-f.\conda-envs\windows-environment-dev.yml
    condaenvcreate-fconda-envs/windows-environment-dev.yml
    condaactivatepymc-devpipinstall-e.

    Alternatively you may (probably in avirtual environment) run:

    pipinstall-e.pipinstall-rrequirements-dev.txt
  1. Develop the feature on your feature branch.

    gitcheckoutmy-feature# no -b flag because the branch is already created
  2. Before committing, runpre-commit checks.

    pipinstallpre-commitpre-commitrun--all# 👈 to run it manuallypre-commitinstall# 👈 to run it automatically before each commit
  3. Add changed files usinggitadd and thengitcommit files:

    $gitaddmodified_files$gitcommit

    to record your changes locally.

  4. After committing, it is a good idea to sync with the base repository in case there have been any changes:

    gitfetchupstreamgitrebaseupstream/main

    Then push the changes to the fork in your GitHub account with:

    gitpush-uoriginmy-feature

    If this is your first contribution, the start of some CI jobs will have to be approved by a maintainer.

  5. Go to the GitHub web page of your fork of the PyMC repo.Click the ‘Pull request’ button to send your changes to the project’s maintainers for review.This will send a notification to the committers.

    Tip

    Now that your PR is ready, read thePull request checklist to make sure it follows best practices.