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.
Read the Etiquette for code contributions.
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.
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 email@example.com:<your GitHub handle>/pymc.git cd pymc git remote add upstream firstname.lastname@example.org:pymc-devs/pymc.git
featurebranch to hold your development changes:
git checkout -b my-feature
Always use a
featurebranch. It’s good practice to never routinely work on the
mainbranch of any repository.
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.yml
conda env create -f .\conda-envs\windows-environment-dev.yml
conda env create -f conda-envs/windows-environment-dev.yml
conda activate pymc-dev pip install -e .
Alternatively you may (probably in a virtual environment) run:
pip install -e . pip install -r requirements-dev.txt
Develop the feature on your feature branch.
git checkout my-feature # no -b flag because the branch is already created
Before committing, run
pip install pre-commit pre-commit run --all # 👈 to run it manually pre-commit install # 👈 to run it automatically before each commit
Add changed files using
git addand then
$ git add modified_files $ git commit
to record your changes locally.
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
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.
Now that your PR is ready, read the Pull request checklist to make sure it follows best practices.