<liclass="toctree-l1 has-children"><aclass="reference internal" href="development_setup.html">Setting up Matplotlib for development</a><details><summary><spanclass="toctree-toggle" role="presentation"><iclass="fa-solid fa-chevron-down"></i></span></summary><ul>
<liclass="toctree-l2"><aclass="reference internal" href="MEP/MEP12.html">MEP12: Improve Gallery and Examples</a></li>
<liclass="toctree-l2"><aclass="reference internal" href="MEP/MEP13.html">MEP13: Use properties for Artists</a></li>
<liclass="toctree-l2"><aclass="reference internal" href="MEP/MEP14.html">MEP14: Text handling</a></li>
<liclass="toctree-l2"><aclass="reference internal" href="MEP/MEP15.html">MEP15: Fix axis autoscaling when limits are specified for one axis only</a></li>
<spanid="pr-guidelines"></span><h1>Pull request guidelines<aclass="headerlink" href="#pull-request-guidelines" title="Link to this heading">#</a></h1>
<p><aclass="reference external" href="https://docs.github.com/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests">Pull requests (PRs) on GitHub</a>
are the mechanism for contributing to Matplotlib's code and documentation.</p>
<p>We value contributions from people with all levels of experience. In particular,
if this is your first PR not everything has to be perfect. We'll guide you
through the PR process. Nevertheless, please try to follow our guidelines as well
as you can to help make the PR process quick and smooth. If your pull request is
incomplete or a work-in-progress, please mark it as a <aclass="reference external" href="https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests">draft pull requests</a>
on GitHub and specify what feedback from the developers would be helpful.</p>
<p>Please be patient with reviewers. We try our best to respond quickly, but we have
limited bandwidth. If there is no feedback within a couple of days, please ping
us by posting a comment to your PR or reaching out on a <aclass="reference internal" href="communication_guide.html#communication-channels"><spanclass="std std-ref">communication channel</span></a></p>
<sectionid="summary-for-pull-request-authors">
<h2>Summary for pull request authors<aclass="headerlink" href="#summary-for-pull-request-authors" title="Link to this heading">#</a></h2>
<p>We recommend that you check that your contribution complies with the following
guidelines before submitting a pull request:</p>
<ulclass="checklist simple">
<li><p>Changes, both new features and bugfixes, should have good test coverage. See
<aclass="reference internal" href="testing.html#testing"><spanclass="std std-ref">Testing</span></a> for more details.</p></li>
<li><p>Update the <aclass="reference internal" href="#pr-documentation"><spanclass="std std-ref">documentation</span></a> if necessary.</p></li>
<li><p>All public methods should have informative docstrings with sample usage when
appropriate. Use the <aclass="reference internal" href="document.html#writing-docstrings"><spanclass="std std-ref">docstring standards</span></a>.</p></li>
<li><p>For high-level plotting functions, consider adding a small example to the
<li><p>If you add a major new feature or change the API in a backward-incompatible
way, please document it as described in <aclass="reference internal" href="api_changes.html#api-changes"><spanclass="std std-ref">API guidelines</span></a>.</p></li>
<li><p>Code should follow our conventions as documented in our <aclass="reference internal" href="coding_guide.html#coding-guidelines"><spanclass="std std-ref">Coding guidelines</span></a>.</p></li>
<li><p>When adding or changing public function signatures, add <aclass="reference internal" href="coding_guide.html#type-hints"><spanclass="std std-ref">type hints</span></a>.</p></li>
<li><p>When adding keyword arguments, see our guide to <aclass="reference internal" href="coding_guide.html#keyword-argument-processing"><spanclass="std std-ref">Keyword argument processing</span></a>.</p></li>
</ul>
<p>When opening a pull request on Github, please ensure that:</p>
<ulclass="checklist simple">
<li><p>Changes were made on a <aclass="reference internal" href="development_workflow.html#make-feature-branch"><spanclass="std std-ref">feature branch</span></a>.</p></li>
<li><p><aclass="reference internal" href="development_setup.html#pre-commit-hooks"><spanclass="std std-ref">pre-commit</span></a> checks for spelling, formatting, etc pass</p></li>
<li><p>The pull request targets the <aclass="reference internal" href="#pr-branch-selection"><spanclass="std std-ref">main branch</span></a></p></li>
<li><p>If your pull request addresses an issue, please use the title to describe the
issue (e.g. "Add ability to plot timedeltas") and mention the issue number
in the pull request description to ensure that a link is created to the
original issue (e.g. "Closes #8869" or "Fixes #8869"). This will ensure the
original issue mentioned is automatically closed when your PR is merged. For more
details, see <aclass="reference external" href="https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue">linking an issue and pull request</a>.</p></li>
<h2>Summary for pull request reviewers<aclass="headerlink" href="#summary-for-pull-request-reviewers" title="Link to this heading">#</a></h2>
<p><strong>Please help review and merge PRs!</strong></p>
<p>If you have commit rights, then you are trusted to use them. Please be patient
and <aclass="reference external" href="https://youtu.be/tzFWz5fiVKU?t=49m30s">kind</a> with contributors.</p>
<p>When reviewing, please ensure that the pull request satisfies the following
requirements before merging it:</p>
<sectionid="content">
<h3>Content<aclass="headerlink" href="#content" title="Link to this heading">#</a></h3>
<ulclass="checklist simple">
<li><p>Is the feature / bugfix reasonable?</p></li>
<li><p>Does the PR conform with the <aclass="reference internal" href="coding_guide.html#coding-guidelines"><spanclass="std std-ref">Coding guidelines</span></a>?</p></li>
<li><p>Is the <aclass="reference internal" href="#pr-documentation"><spanclass="std std-ref">documentation</span></a> (docstrings, examples,
what's new, API changes) updated?</p></li>
<li><p>Is the change purely stylistic? Generally, such changes are discouraged when
not part of other non-stylistic work because it obscures the git history of
functional changes to the code. Reflowing a method or docstring as part of a
larger refactor/rewrite is acceptable.</p></li>
</ul>
</section>
<sectionid="workflow">
<h3>Workflow<aclass="headerlink" href="#workflow" title="Link to this heading">#</a></h3>
<ulclass="checklist simple">
<li><p>Make sure all <aclass="reference internal" href="#pr-automated-tests"><spanclass="std std-ref">automated tests</span></a> pass.</p></li>
<li><p>The PR should <aclass="reference internal" href="#pr-branch-selection"><spanclass="std std-ref">target the main branch</span></a>.</p></li>
<li><p>Tag with descriptive <aclass="reference internal" href="#pr-labels"><spanclass="std std-ref">labels</span></a>.</p></li>
<li><p>Set the <aclass="reference internal" href="#pr-milestones"><spanclass="std std-ref">milestone</span></a>.</p></li>
<li><p>Keep an eye on the <aclass="reference internal" href="#pr-squashing"><spanclass="std std-ref">number of commits</span></a>.</p></li>
<li><p>Approve if all of the above topics are handled.</p></li>
<li><p><aclass="reference internal" href="#pr-merging"><spanclass="std std-ref">Merge</span></a> if a sufficient number of approvals is reached.</p></li>
</ul>
</section>
</section>
<sectionid="detailed-guidelines">
<spanid="pr-guidelines-details"></span><h2>Detailed guidelines<aclass="headerlink" href="#detailed-guidelines" title="Link to this heading">#</a></h2>
<sectionid="documentation">
<spanid="pr-documentation"></span><h3>Documentation<aclass="headerlink" href="#documentation" title="Link to this heading">#</a></h3>
<ulclass="simple">
<li><p>Every new feature should be documented. If it's a new module, don't
forget to add a new rst file to the API docs.</p></li>
<li><p>Each high-level plotting function should have a small example in
the <codeclass="docutils literal notranslate"><spanclass="pre">Examples</span></code> section of the docstring. This should be as simple as
possible to demonstrate the method. More complex examples should go into
a dedicated example file in the <codeclass="file docutils literal notranslate"><spanclass="pre">examples</span></code> directory, which will be
rendered to the examples gallery in the documentation.</p></li>
<li><p>Build the docs and make sure all formatting warnings are addressed.</p></li>
<p>If multiple rules apply, choose the first matching from the above list. See
<aclass="reference internal" href="#backport-strategy"><spanclass="std std-ref">Backport strategy</span></a> for detailed guidance on what should or should not be
backported.</p>
<p>The milestone marks the release a PR should go into. It states intent, but can
be changed because of release planning or re-evaluation of the PR scope and
maturity.</p>
<p>All Pull Requests should target the main branch. The milestone tag triggers
an <aclass="reference internal" href="#automated-backports"><spanclass="std std-ref">automatic backport</span></a> for milestones which have
a corresponding branch.</p>
</section>
<sectionid="merging">
<spanid="pr-merging"></span><h3>Merging<aclass="headerlink" href="#merging" title="Link to this heading">#</a></h3>
<ul>
<li><p>Documentation and examples may be merged by the first reviewer. Use
the threshold "is this better than it was?" as the review criteria.</p></li>
<li><p>For code changes (anything in <codeclass="docutils literal notranslate"><spanclass="pre">src</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">lib</span></code>) at least two
core developers (those with commit rights) should review all pull
requests. If you are the first to review a PR and approve of the
changes use the GitHub <aclass="reference external" href="https://docs.github.com/en/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests">'approve review'</a>
tool to mark it as such. If you are a subsequent reviewer please
approve the review and if you think no more review is needed, merge
the PR.</p>
<p>Ensure that all API changes are documented in a file in one of the
subdirectories of <codeclass="file docutils literal notranslate"><spanclass="pre">doc/api/next_api_changes</span></code>, and significant new
features have an entry in <codeclass="file docutils literal notranslate"><spanclass="pre">doc/user/whats_new</span></code>.</p>
<ul>
<li><p>If a PR already has a positive review, a core developer (e.g. the first
reviewer, but not necessarily) may champion that PR for merging. In order
to do so, they should ping all core devs both on GitHub and on the dev
mailing list, and label the PR with the "Merge with single review?" label.
Other core devs can then either review the PR and merge or reject it, or
simply request that it gets a second review before being merged. If no one
asks for such a second review within a week, the PR can then be merged on
the basis of that single review.</p>
<p>A core dev should only champion one PR at a time and we should try to keep
the flow of championed PRs reasonable.</p>
</li>
</ul>
</li>
<li><p>Do not self merge, except for 'small' patches to un-break the CI or
when another reviewer explicitly allows it (ex, "Approve modulo CI
passing, may self merge when green").</p></li>
</ul>
</section>
<sectionid="automated-tests">
<spanid="pr-automated-tests"></span><h3>Automated tests<aclass="headerlink" href="#automated-tests" title="Link to this heading">#</a></h3>
<p>Before being merged, a PR should pass the <aclass="reference internal" href="development_workflow.html#automated-tests"><spanclass="std std-ref">Automated tests</span></a>. If you are
unsure why a test is failing, ask on the PR or in our <aclass="reference internal" href="communication_guide.html#communication-channels"><spanclass="std std-ref">Official communication channels</span></a></p>
</section>
<sectionid="number-of-commits-and-squashing">
<spanid="pr-squashing"></span><h3>Number of commits and squashing<aclass="headerlink" href="#number-of-commits-and-squashing" title="Link to this heading">#</a></h3>
<ulclass="simple">
<li><p>Squashing is case-by-case. The balance is between burden on the
contributor, keeping a relatively clean history, and keeping a
history usable for bisecting. The only time we are really strict
about it is to eliminate binary files (ex multiple test image
re-generations) and to remove upstream merges.</p></li>
<li><p>Do not let perfect be the enemy of the good, particularly for
documentation or example PRs. If you find yourself making many
small suggestions, either open a PR against the original branch,
push changes to the contributor branch, or merge the PR and then
open a new PR against upstream.</p></li>
<li><p>If you push to a contributor branch leave a comment explaining what
you did, ex "I took the liberty of pushing a small clean-up PR to
your branch, thanks for your work.". If you are going to make
substantial changes to the code or intent of the PR please check
with the contributor first.</p></li>
</ul>
</section>
</section>
<sectionid="branches-and-backports">
<spanid="id1"></span><h2>Branches and backports<aclass="headerlink" href="#branches-and-backports" title="Link to this heading">#</a></h2>
<sectionid="current-branches">
<h3>Current branches<aclass="headerlink" href="#current-branches" title="Link to this heading">#</a></h3>
<p>The current active branches are</p>
<dlclass="simple">
<dt><em>main</em></dt><dd><p>The current development version. Future meso (<em>v3.N.0</em>) or macro (<em>v4.0.0</em>) will be
branched from this.</p>
</dd>
<dt><em>v3.N.x</em></dt><dd><p>Maintenance branch for Matplotlib 3.N. Future micro releases will be
tagged from this.</p>
</dd>
<dt><em>v3.N.M-doc</em></dt><dd><p>Documentation for the current micro release. On a micro release, this will be
replaced by a properly named branch for the new release.</p>
</dd>
</dl>
</section>
<sectionid="branch-selection-for-pull-requests">
<spanid="pr-branch-selection"></span><h3>Branch selection for pull requests<aclass="headerlink" href="#branch-selection-for-pull-requests" title="Link to this heading">#</a></h3>
<p>Generally, all pull requests should target the main branch.</p>
<p>Other branches are fed through <aclass="reference internal" href="#automated-backports"><spanclass="std std-ref">automatic</span></a> or
targeting other branches is only rarely necessary for special maintenance
work.</p>
</section>
<sectionid="backport-strategy">
<spanid="id2"></span><h3>Backport strategy<aclass="headerlink" href="#backport-strategy" title="Link to this heading">#</a></h3>
<p>Backports to the micro release branch (<em>v3.N.x</em>) are the changes that will be
included in the next patch (aka bug-fix) release. The goal of the patch
releases is to fix bugs without adding any new regressions or behavior changes.
We will always attempt to backport:</p>
<ulclass="simple">
<li><p>critical bug fixes (segfault, failure to import, things that the
user cannot work around)</p></li>
<li><p>fixes for regressions introduced in the last two meso releases</p></li>
</ul>
<p>and may attempt to backport fixes for regressions introduced in older releases.</p>
<p>In the case where the backport is not clean, for example if the bug fix is
built on top of other code changes we do not want to backport, balance the
effort and risk of re-implementing the bug fix vs the severity of the bug.
When in doubt, err on the side of not backporting.</p>
<p>When backporting a Pull Request fails or is declined, re-milestone the original
PR to the next meso release and leave a comment explaining why.</p>
<p>The only changes backported to the documentation branch (<em>v3.N.M-doc</em>)
are changes to <codeclass="file docutils literal notranslate"><spanclass="pre">doc</span></code> or <codeclass="file docutils literal notranslate"><spanclass="pre">galleries</span></code>. Any changes to <codeclass="file docutils literal notranslate"><spanclass="pre">lib</span></code>
or <codeclass="file docutils literal notranslate"><spanclass="pre">src</span></code>, including docstring-only changes, must not be backported to
this branch.</p>
</section>
<sectionid="automated-backports">
<spanid="id3"></span><h3>Automated backports<aclass="headerlink" href="#automated-backports" title="Link to this heading">#</a></h3>
<p>We use MeeseeksDev bot to automatically backport merges to the correct
maintenance branch base on the milestone. To work properly the
milestone must be set before merging. If you have commit rights, the
bot can also be manually triggered after a merge by leaving a message
<codeclass="docutils literal notranslate"><spanclass="pre">@meeseeksdev</span><spanclass="pre">backport</span><spanclass="pre">to</span><spanclass="pre">BRANCH</span></code> on the PR. If there are conflicts
MeeseeksDev will inform you that the backport needs to be done
manually.</p>
<p>The target branch is configured by putting <codeclass="docutils literal notranslate"><spanclass="pre">on-merge:</span><spanclass="pre">backport</span><spanclass="pre">to</span>
<spanclass="pre">TARGETBRANCH</span></code> in the milestone description on it's own line.</p>
<p>If the bot is not working as expected, please report issues to
<spanid="id4"></span><h3>Manual backports<aclass="headerlink" href="#manual-backports" title="Link to this heading">#</a></h3>
<p>When doing backports please copy the form used by MeeseeksDev,
<codeclass="docutils literal notranslate"><spanclass="pre">Backport</span><spanclass="pre">PR</span><spanclass="pre">#XXXX:</span><spanclass="pre">TITLE</span><spanclass="pre">OF</span><spanclass="pre">PR</span></code>. If you need to manually resolve
conflicts make note of them and how you resolved them in the commit
message.</p>
<p>We do a backport from main to v2.2.x assuming:</p>
<ulclass="simple">
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">matplotlib</span></code> is a read-only remote branch of the matplotlib/matplotlib repo</p></li>
</ul>
<p>The <codeclass="docutils literal notranslate"><spanclass="pre">TARGET_SHA</span></code> is the hash of the merge commit you would like to
backport. This can be read off of the GitHub PR page (in the UI with
the merge notification) or through the git CLI tools.</p>
<p>Assuming that you already have a local branch <codeclass="docutils literal notranslate"><spanclass="pre">v2.2.x</span></code> (if not, then
<codeclass="docutils literal notranslate"><spanclass="pre">git</span><spanclass="pre">checkout</span><spanclass="pre">-b</span><spanclass="pre">v2.2.x</span></code>), and that your remote pointing to
<codeclass="docutils literal notranslate"><spanclass="pre">https://github.com/matplotlib/matplotlib</span></code> is called <codeclass="docutils literal notranslate"><spanclass="pre">upstream</span></code>:</p>
git<spanclass="w"></span>checkout<spanclass="w"></span>v2.2.x<spanclass="w"></span><spanclass="c1"># or include -b if you don't already have this.</span>
<p>Use your discretion to push directly to upstream or to open a PR; be
sure to push or PR against the <codeclass="docutils literal notranslate"><spanclass="pre">v2.2.x</span></code> upstream branch, not <codeclass="docutils literal notranslate"><spanclass="pre">main</span></code>!</p>
<liclass="toc-h3 nav-item toc-entry"><aclass="reference internal nav-link" href="#number-of-commits-and-squashing">Number of commits and squashing</a></li>
</ul>
</li>
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#branches-and-backports">Branches and backports</a><ulclass="nav section-nav flex-column">