doc/source/dev/reviewer_guidelines.rst
.. _reviewer-guidelines:
Reviewing open pull requests (PRs) helps move the project forward. We encourage people outside the project to get involved as well; it's a great way to get familiar with the codebase.
Reviews can come from outside the NumPy team -- we welcome contributions from
domain experts (for instance, linalg or fft) or maintainers of other
projects. You do not need to be a NumPy maintainer (a NumPy team member with
permission to merge a PR) to review.
If we do not know you yet, consider introducing yourself in the mailing list or Slack <https://numpy.org/community/>_ before you start reviewing pull requests.
the kind of project it will be <https://numpy.org/code-of-conduct/>: open, empathetic,
welcoming, friendly and patient. Be kind <https://youtu.be/tzFWz5fiVKU?t=49m30s> to contributors.standard replies for reviewing<saved-replies>.int or tuples?dtypes tested if a function supports those?NumPy guidelines<howto-document>? Are
the docstrings properly formatted?Stylistic Guidelines<stylistic-guidelines>?approve review <https://help.github.com/articles/reviewing-changes-in-pull-requests/>_ tool
to mark it as such. If a PR is straightforward, for example it's a clearly
correct bug fix, it can be merged straight away. If it's more complex or
changes public API, please leave it open for at least a couple of days so
other maintainers get a chance to review.documentation builds <building-docs> without any errors.rebase on main <rebasing-on-main>.Development process guidelines <guidelines> for NumPy. Also, check that new features and backwards
compatibility breaks were discussed on the numpy-discussion mailing list <https://mail.python.org/mailman/listinfo/numpy-discussion>_.rules for NumPy <writing-the-commit-message>.As mentioned most public API changes should be discussed ahead of time and often with a wider audience (on the mailing list, or even through a NEP).
For changes in the public C-API be aware that the NumPy C-API is backwards compatible so that any addition must be ABI compatible with previous versions. When it is not the case, you must add a guard.
For example PyUnicodeScalarObject struct contains the following::
#if NPY_FEATURE_VERSION >= NPY_1_20_API_VERSION
char *buffer_fmt;
#endif
Because the buffer_fmt field was added to its end in NumPy 1.20 (all
previous fields remained ABI compatible).
Similarly, any function added to the API table in
numpy/_core/code_generators/numpy_api.py must use the MinVersion
annotation.
For example::
'PyDataMem_SetHandler': (304, MinVersion("1.22")),
Header only functionality (such as a new macro) typically does not need to be guarded.
When reviewing pull requests, please use workflow tracking features on GitHub as appropriate:
It may be helpful to have a copy of the pull request code checked out on your
own machine so that you can play with it locally. You can use the GitHub CLI <https://docs.github.com/en/github/getting-started-with-github/github-cli>_ to
do this by clicking the Open with button in the upper right-hand corner of
the PR page.
Assuming you have your :ref:development environment<development-environment>
set up, you can now build the code and test it.
.. _saved-replies:
It may be helpful to store some of these in GitHub's saved replies <https://github.com/settings/replies/>_ for reviewing:
Usage question .. code-block:: md
You are asking a usage question. The issue tracker is for bugs and new features.
I'm going to close this issue, feel free to ask for help via our [help channels](https://numpy.org/gethelp/).
You’re welcome to update the docs .. code-block:: md
Please feel free to offer a pull request updating the documentation if you feel it could be improved.
Self-contained example for bug .. code-block:: md
Please provide a [self-contained example code](https://stackoverflow.com/help/mcve), including imports and data (if possible), so that other contributors can just run it and reproduce your issue.
Ideally your example code should be minimal.
Software versions .. code-block:: md
To help diagnose your issue, please paste the output of:
```
python -c 'import numpy; print(numpy.version.version)'
```
Thanks.
Code blocks .. code-block:: md
Readability can be greatly improved if you [format](https://help.github.com/articles/creating-and-highlighting-code-blocks/) your code snippets and complete error messages appropriately.
You can edit your issue descriptions and comments at any time to improve readability.
This helps maintainers a lot. Thanks!
Linking to code .. code-block:: md
For clarity's sake, you can link to code like [this](https://help.github.com/articles/creating-a-permanent-link-to-a-code-snippet/).
Better description and title .. code-block:: md
Please make the title of the PR more descriptive.
The title will become the commit message when this is merged.
You should state what issue (or PR) it fixes/resolves in the description using the syntax described [here](https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword).
Regression test needed .. code-block:: md
Please add a [non-regression test](https://en.wikipedia.org/wiki/Non-regression_testing) that would fail at main but pass in this PR.
Don’t change unrelated .. code-block:: md
Please do not change unrelated lines. It makes your contribution harder to review and may introduce merge conflicts to other pull requests.