You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: getting-started/pull-request-lifecycle.rst
+88-88Lines changed: 88 additions & 88 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,94 +16,6 @@ that you create a branch in Git, make your changes, push those changes
16
16
to your fork on GitHub (``origin``), and then create a pull request against
17
17
the official CPython repository (``upstream``).
18
18
19
-
.. _good-prs:
20
-
21
-
Making Good PRs
22
-
===============
23
-
24
-
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.
25
-
26
-
1. **Use a Clear and Structured PR Title**
27
-
28
-
PR titles often become commit messages, making them **critical for maintainability and searchability**. Follow these guidelines:
29
-
30
-
**Do:**
31
-
32
-
- Clearly summarize the change in a concise manner.
33
-
- Use the **imperative mood** (e.g., "Fix crash in parser" instead of "Fixed a crash in parser").
34
-
- Be specific about what is being changed (avoid vague words like "Update" or "Fix").
35
-
36
-
**Avoid:**
37
-
38
-
- "Bug fix" → Too vague. What bug was fixed?
39
-
- "Update README" → What was updated? Be precise.
40
-
- "Refactoring" → Explain what was refactored and why.
41
-
42
-
**Example of a good PR title:**
43
-
44
-
``Improve error handling in JSON parser to prevent crashes``
45
-
46
-
2. **Write a Meaningful PR Description**
47
-
48
-
Your PR description should provide **clear context** for reviewers. Answer the following questions:
49
-
50
-
- **What does this PR do?**
51
-
- **Why is this change necessary?**
52
-
- **Are there any breaking changes?**
53
-
- **Does this PR fix any open issues?** (Reference issue numbers if applicable)
54
-
55
-
Providing detailed descriptions makes the review process **faster and more efficient**.
56
-
57
-
3. **Make Your Change Against the Right Branch**
58
-
59
-
Ensure your PR is based on the correct branch:
60
-
61
-
- **New changes should target the** ``main`` **branch unless they are specific to an older version.**
62
-
- If a change affects older versions, it will be **backported** after merging.
63
-
- Only use **maintenance branches** when the change does not apply to ``main`` or requires a different approach.
64
-
65
-
Refer to :ref:`branch-merge` for more details on how backporting works.
66
-
67
-
4. **Follow Python's Style Guidelines**
68
-
69
-
- Python code should follow :PEP:`8`, and C code should follow :PEP:`7`.
70
-
- Maintainers may **fix minor style issues**, but major deviations can **delay or block merging**.
71
-
- PRs with **only style changes** are usually rejected unless they fix a formatting error.
72
-
73
-
.. note::
74
-
Fixes for typos and grammar errors in documentation and docstrings are always welcome.
75
-
76
-
5. **Consider Backward Compatibility**
77
-
78
-
- Changes should **not break existing code** unless absolutely necessary.
79
-
- When introducing **new arguments**, provide **default values** to maintain existing behavior.
80
-
- If unsure, refer to :PEP:`387` or discuss the issue with experienced maintainers in :ref:`communication`.
81
-
82
-
Think about how your change affects existing users before submitting your PR.
83
-
84
-
6. **Ensure Proper Testing**
85
-
86
-
- Every PR should include **appropriate test cases** to validate the changes.
87
-
- PRs without tests **will not be accepted** unless they are purely documentation changes.
88
-
- Tests should **cover edge cases** and expected behaviors.
89
-
- For bug fixes, add a test that **fails without the fix** and **passes after applying it**.
90
-
91
-
7. **Make Sure All Tests Pass**
92
-
93
-
- The entire test suite must **run without failures** before submission.
94
-
- Run ``make test`` or refer to :ref:`runtests` to check for test failures.
95
-
- Do not submit PRs with failing tests unless the failure is **directly related** to your change.
96
-
97
-
8. **Keep Documentation Up to Date**
98
-
99
-
- Any change affecting functionality should include relevant **documentation updates**.
100
-
- Follow :ref:`documenting` guidelines to ensure consistency in documentation.
101
-
102
-
Keeping documentation updated ensures clarity for future contributors and users.
103
-
104
-
By following these best practices, you increase the likelihood of your PR being **quickly reviewed and merged**!
105
-
106
-
107
19
108
20
.. _pullrequest-quickguide:
109
21
@@ -271,6 +183,94 @@ message. It is usually okay to leave that as-is and close the editor.
271
183
See `the merge command's documentation <https://git-scm.com/docs/git-merge>`_
272
184
for a detailed technical explanation.
273
185
186
+
.. _good-prs:
187
+
188
+
Making Good PRs
189
+
===============
190
+
191
+
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.
192
+
193
+
1. **Use a Clear and Structured PR Title**
194
+
195
+
PR titles often become commit messages, making them **critical for maintainability and searchability**. Follow these guidelines:
196
+
197
+
**Do:**
198
+
199
+
- Clearly summarize the change in a concise manner.
200
+
- Use the **imperative mood** (e.g., "Fix crash in parser" instead of "Fixed a crash in parser").
201
+
- Be specific about what is being changed (avoid vague words like "Update" or "Fix").
202
+
203
+
**Avoid:**
204
+
205
+
- "Bug fix" → Too vague. What bug was fixed?
206
+
- "Update README" → What was updated? Be precise.
207
+
- "Refactoring" → Explain what was refactored and why.
208
+
209
+
**Example of a good PR title:**
210
+
211
+
``Improve error handling in JSON parser to prevent crashes``
212
+
213
+
2. **Write a Meaningful PR Description**
214
+
215
+
Your PR description should provide **clear context** for reviewers. Answer the following questions:
216
+
217
+
- **What does this PR do?**
218
+
- **Why is this change necessary?**
219
+
- **Are there any breaking changes?**
220
+
- **Does this PR fix any open issues?** (Reference issue numbers if applicable)
221
+
222
+
Providing detailed descriptions makes the review process **faster and more efficient**.
223
+
224
+
3. **Make Your Change Against the Right Branch**
225
+
226
+
Ensure your PR is based on the correct branch:
227
+
228
+
- **New changes should target the** ``main`` **branch unless they are specific to an older version.**
229
+
- If a change affects older versions, it will be **backported** after merging.
230
+
- Only use **maintenance branches** when the change does not apply to ``main`` or requires a different approach.
231
+
232
+
Refer to :ref:`branch-merge` for more details on how backporting works.
233
+
234
+
4. **Follow Python's Style Guidelines**
235
+
236
+
- Python code should follow :PEP:`8`, and C code should follow :PEP:`7`.
237
+
- Maintainers may **fix minor style issues**, but major deviations can **delay or block merging**.
238
+
- PRs with **only style changes** are usually rejected unless they fix a formatting error.
239
+
240
+
.. note::
241
+
Fixes for typos and grammar errors in documentation and docstrings are always welcome.
242
+
243
+
5. **Consider Backward Compatibility**
244
+
245
+
- Changes should **not break existing code** unless absolutely necessary.
246
+
- When introducing **new arguments**, provide **default values** to maintain existing behavior.
247
+
- If unsure, refer to :PEP:`387` or discuss the issue with experienced maintainers in :ref:`communication`.
248
+
249
+
Think about how your change affects existing users before submitting your PR.
250
+
251
+
6. **Ensure Proper Testing**
252
+
253
+
- Every PR should include **appropriate test cases** to validate the changes.
254
+
- PRs without tests **will not be accepted** unless they are purely documentation changes.
255
+
- Tests should **cover edge cases** and expected behaviors.
256
+
- For bug fixes, add a test that **fails without the fix** and **passes after applying it**.
257
+
258
+
7. **Make Sure All Tests Pass**
259
+
260
+
- The entire test suite must **run without failures** before submission.
261
+
- Run ``make test`` or refer to :ref:`runtests` to check for test failures.
262
+
- Do not submit PRs with failing tests unless the failure is **directly related** to your change.
263
+
264
+
8. **Keep Documentation Up to Date**
265
+
266
+
- Any change affecting functionality should include relevant **documentation updates**.
267
+
- Follow :ref:`documenting` guidelines to ensure consistency in documentation.
268
+
269
+
Keeping documentation updated ensures clarity for future contributors and users.
270
+
271
+
By following these best practices, you increase the likelihood of your PR being **quickly reviewed and merged**!
0 commit comments