Physlib

Learn

GitHub Guide

Use this guide to create a branch, open a pull request, and work through review on GitHub.

Choose a Task

Start with Find a Task to see what is already open.

Creating a GitHub Issue

Open an issue to describe a problem or feature and let maintainers know what you plan to work on.

  • A clear title summarizing the problem or feature.
  • Explain the motivation for the feature.
  • Any relevant links.
  • A summary of the incorrect code (for bugs).
Open an Issue ↗

Asking the Community

Ask in the Physlib Zulip channel if you want to discuss an idea or get help choosing a task before opening an issue.

Visit the Physlib Zulip ↗

Create a Branch

Follow the “I want to contribute” instructions in Getting Started to fork Physlib and clone it. In that checkout, origin points to your fork and upstream points to leanprover-community/physlib. Create a branch for your changes from the current upstream master.

Terminal
git fetch upstream
git switch --no-track -c my-change upstream/master

Open a Pull Request

Keep each pull request focused on one change. After editing, building, and linting, run these commands from your checkout. Replace path/to/file with your changed file paths and write a commit message describing your change.

Terminal
git status --short
git add -- path/to/file
git diff --cached
git commit -m "Describe your change"
git push -u origin my-change

GitHub usually shows a banner offering to open the PR for you right after you push. If you don't see it, go to the compare page and click "compare across forks". Set the base repository to leanprover-community/physlib and the base branch to master. Select your fork as the head repository and my-change as the compare branch. Describe your change and how you checked it in your own words.

Adding Labels

If your PR needs a subject label, comment with its name on a line by itself. For example, t-relativity marks a contribution to relativity. See the available labels.

Lifecycle of a PR

A reviewer can add awaiting-author when you need to respond. After addressing the feedback, comment -awaiting-author on a line by itself to return your PR to the review queue. Once they're happy, they'll mark it reviewer-approved. Then a maintainer can look at the PR and add the ready-to-merge label to add your change to the merge queue, where the final quality checks are run.

Other Common Labels

  • WIP — the PR still needs foundational work (e.g. it contains sorry) before it's ready for review. Use it to signal you're working on something you expect to finish soon.
  • help-wanted — directly soliciting contributions on an issue or PR.
  • easy— a trivial change (a single lemma, a typo fix, a diff under ~25 lines, no new definitions) that maintainers prioritize reviewing first to keep the queue moving. If you're unsure whether your PR qualifies, don't add it.
  • blocked-by-PR / blocked-by-mathlib-PR— this PR depends on another PR being merged first. Include the blocking PR's number in the title or a comment so reviewers know what to check first.
  • merge-conflict — your branch has diverged from masterin a way Git can't resolve automatically. See GitHub's guide to resolving merge conflicts for how to fix it.

Managing the PR

After opening a PR, automated checks will run and a reviewer will provide feedback, following the review guidelines. The first review can take several days, and if you have never had a PR merged a reviewer may need to start the checks for you. Feel free to begin work on a separate PR in the meantime but be prepared to make changes to this one if required.

If you want a reviewer to be able to push fixes directly to your branch, you can grant them collaborator access via your fork's Settings → Collaborators. Once they accept, they can push to your PR branch directly.

If you get stuck at any point, the Physlib Zulip is full of people who are happy to give advice.

Merging the PR

Approved changes merge into master. Physlib uses a merge queue to ensure that consecutive changes do not produce unexpected errors. This may result in your PR being rejected with errors you have not seen before.

Additional Guidance

If you used AI to prepare a change, check the AI contribution guidelines before submitting it.

Please use your real name in your GitHub account settings and commit author. Physlib uses GitHub account names in its automated documentation generation, so using your real name makes it easier for people to recognize your work.

If you are contributing to PhyslibAlpha, which sits downstream of Physlib, Lean code quality guidelines are less strict. However, please still follow this GitHub Guide.