Pull request step-by-step#

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

Steps#

  1. Read the Etiquette for code contributions.

  2. Fork the project 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:

    git clone git@github.com:<your GitHub handle>/pymc.git
    cd pymc
    git remote add upstream git@github.com:pymc-devs/pymc.git
    
  4. Create a feature branch to hold your development changes:

    git checkout -b my-feature
    

    Attention

    Always use a feature branch. It’s good practice to never routinely work on the main branch of any repository.

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

    conda env create -f conda-envs/environment-dev-py39.yml  # or py3x
    
    conda env create -f .\conda-envs\windows-environment-dev-py39.yml
    
    conda activate pymc-dev-py39
    pip install -e .
    

    Alternatively you may (probably in a virtual environment) run:

    pip install -e .
    pip install -r requirements-dev.txt
    
  1. Develop the feature on your feature branch.

    git checkout my-feature   # no -b flag because the branch is already created
    
  2. Before committing, run pre-commit checks.

    pip install pre-commit
    pre-commit run --all      # 👈 to run it manually
    pre-commit install        # 👈 to run it automatically before each commit
    
  3. Add changed files using git add and then git commit files:

    $ git add modified_files
    $ git commit
    

    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:

    git fetch upstream
    git rebase upstream/main
    

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

    git push -u origin my-feature
    
  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 the Pull request checklist to make sure it follows best practices.