Improved 'Making Good PRs' section to improve clarity and maintainability. #1510
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -183,59 +183,86 @@ message. It is usually okay to leave that as-is and close the editor. | |||||
See `the merge command's documentation <https://git-scm.com/docs/git-merge>`_ | ||||||
for a detailed technical explanation. | ||||||
|
||||||
.. _good-prs: | ||||||
|
||||||
Making Good PRs | ||||||
There was a problem hiding this comment. Please retain sentence case: https://devguide.python.org/documentation/style-guide/#capitalization
Suggested change
Same applies to the headers below. |
||||||
=============== | ||||||
|
||||||
Comment on lines
-192
to
-193
There was a problem hiding this comment. I think the previous introduction was better. |
||||||
When creating a pull request, following best practices ensures your contribution is **clear, maintainable, and easy to review**. A well-structured PR improves collaboration and speeds up the review process. | ||||||
|
||||||
1. **Use a Clear and Structured PR Title** | ||||||
There was a problem hiding this comment. This is general guidance, not specific to Python. I'm not sure it makes sense to give this sort of general guideline: the devguide is more helpful to developers who want to start contributing to Python if it talks specifically about what's special about this project. |
||||||
|
||||||
PR titles often become commit messages, making them **critical for maintainability and searchability**. Follow these guidelines: | ||||||
|
||||||
**Do:** | ||||||
|
||||||
- Clearly summarize the change in a concise manner. | ||||||
- Use the **imperative mood** (e.g., "Fix crash in parser" instead of "Fixed a crash in parser"). | ||||||
There was a problem hiding this comment. Maybe add a link to a better guide/more information? This would be helpful for non English natives. https://en.wikipedia.org/wiki/Imperative_mood |
||||||
- Be specific about what is being changed (avoid vague words like "Update" or "Fix"). | ||||||
|
||||||
**Example of a good PR title:** | ||||||
|
||||||
``gh-128002: Simplify all_tasks to use PyList_Extend instead of manual iteration`` | ||||||
|
||||||
#. **Write a detailed description** | ||||||
|
||||||
Your PR description should provide **clear context** for reviewers. Answer the following questions: | ||||||
|
||||||
- What does this PR do? | ||||||
- **Why is this change necessary?** | ||||||
- **Are there any breaking changes?** | ||||||
- **Does this PR fix any open issues?** (Reference issue numbers if applicable) | ||||||
|
||||||
Providing detailed descriptions makes the review process **faster and more efficient**. | ||||||
|
||||||
3. **Make Your Change Against the Right Branch** | ||||||
|
||||||
Ensure your PR is based on the correct branch: | ||||||
|
||||||
- **New changes should target the** ``main`` **branch unless they are specific to an older version.** | ||||||
- If a change affects older versions, it will be **backported** after merging. | ||||||
- Only use **maintenance branches** when the change does not apply to ``main`` or requires a different approach. | ||||||
|
||||||
Refer to :ref:`branch-merge` for more details on how backporting works. | ||||||
|
||||||
4. **Follow Python's Style Guidelines** | ||||||
|
||||||
- Python code should follow :PEP:`8`, and C code should follow :PEP:`7`. | ||||||
- Maintainers may **fix minor style issues**, but major deviations can **delay or block merging**. | ||||||
- PRs with **only style changes** are usually rejected unless they fix a formatting error. | ||||||
|
||||||
.. note:: | ||||||
Comment on lines
-212
to
-214
There was a problem hiding this comment. Why remove this note and replace it with a shorter one? |
||||||
Fixes for typos and grammar errors in documentation and docstrings are always welcome. | ||||||
|
||||||
5. **Consider Backward Compatibility** | ||||||
|
||||||
- Changes should **not break existing code** unless absolutely necessary. | ||||||
- When introducing **new arguments**, provide **default values** to maintain existing behavior. | ||||||
- If unsure, refer to :PEP:`387` or discuss the issue with experienced maintainers in :ref:`communication`. | ||||||
There was a problem hiding this comment.
Suggested change
|
||||||
|
||||||
Think about how your change affects existing users before submitting your PR. | ||||||
|
||||||
6. **Ensure Proper Testing** | ||||||
|
||||||
- Every PR should include **appropriate test cases** to validate the changes. | ||||||
- PRs without tests **will not be accepted** unless they are purely documentation changes. | ||||||
There was a problem hiding this comment.
Suggested change
This is not restricted to docs changes |
||||||
- Tests should **cover edge cases** and expected behaviors. | ||||||
- For bug fixes, add a test that **fails without the fix** and **passes after applying it**. | ||||||
|
||||||
#. **Ensure all tests pass** | ||||||
|
||||||
- The entire test suite must **run without failures** before submission. | ||||||
- Run ``make test`` or refer to :ref:`runtests` to check for test failures. | ||||||
- Do not submit PRs with failing tests unless the failure is **directly related** to your change. | ||||||
|
||||||
8. **Keep Documentation Up to Date** | ||||||
|
||||||
- Any change affecting functionality should include relevant **documentation updates**. | ||||||
- Follow :ref:`documenting` guidelines to ensure consistency in documentation. | ||||||
|
||||||
Keeping documentation updated ensures clarity for future contributors and users. | ||||||
|
||||||
By following these best practices, you increase the likelihood of your PR being **reviewed and merged**! | ||||||
|
||||||
|
||||||
Copyrights | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accidentally removed line