| Oct | NOV | Dec |
| 25 | ||
| 2019 | 2020 | 2021 |
COLLECTED BY
Collection: Common Crawl
●Python »
Python Developer's Guide »
origin), and then create a pull request against
the official CPython repository (upstream).
make patchcheck
(五)Commit and push
changes to your GitHub fork
(六)Create Pull Request on GitHub to merge a branch from your fork
(七)Review and address comments on your Pull Request
(八)When your changes are merged, you can delete the PR branch
(九)Celebrate contributing to CPython! :)
| [*] | If an issue is trivial (e.g. typo fixes), or if an issue already exists, you can skip this step. |
upstream repository:
git fetch upstreamCreate a new branch in your local clone:
git checkout -b <branch-name> upstream/masterMake changes to the code, and use
git status and git diff to see them.
(Learn more about Making Good PRs)
Make sure the changes are fine and don’t cause any test failure:
make patchcheck
./python -m test
(Learn more about patchcheck and about Running & Writing Tests)
Once you are satisfied with the changes, add the files and commit them:
git add <filenames>
git commit -m '<message>'
(Learn more about Making Good Commits)
Then push your work to your GitHub fork:
git push origin <branch-name>Finally go on
https://github.com/<your-username>/cpython: you will
see a box with the branch you just pushed and a green button that allows
you to create a pull request against the official CPython repository.
When people start adding review comments, you can address them by switching
to your branch, making more changes, committing them, and pushing them to
automatically update your PR:
git checkout <branch-name> # make changes and run tests git add <filenames> git commit -m '<message>' git push origin <branch-name>If a core developer reviewing your PR pushed one or more commits to your PR branch, then after checking out your branch and before editing, run:
git pull origin <branch-name> # pull = fetch + merge
If you have made local changes that have not been pushed to your fork and
there are merge conflicts, git will warn you about this and enter conflict
resolution mode. See Resolving Merge Conflicts below.
If time passes and there are merge conflicts with the master branch, GitHub
will show a warning to this end and you may be asked to address this. Merge
the changes from the master branch while resolving the conflicts locally:
git checkout <branch-name> git pull upstream master # pull = fetch + merge # resolve conflicts: see "Resolving Merge Conflicts" below git push origin <branch-name>After your PR has been accepted and merged, you can delete the branch:
git branch -D <branch-name> # delete local branch git push origin -d <branch-name> # delete remote branchNote You can still upload a patch to bugs.python.org, but the GitHub pull request workflow is strongly preferred.
git statusEdit the affected files and bring them to their intended final state. Make sure to remove the special “conflict markers” inserted by git. Commit the affected files:
git add <filenames> git merge --continueWhen running the final command, git may open an editor for writing a commit message. It is usually okay to leave that as-is and close the editor. See the merge command’s documentation for a detailed technical explanation.
patchcheck¶
patchcheck is a simple automated patch checklist that guides a developer
through the common patch generation checks. To run patchcheck:
OnUNIX (including Mac OS X):
make patchcheckOnWindows (after any successful build):
python.bat Tools\scripts\patchcheck.pyThe automated patch checklist runs through: ●Are there any whitespace problems in Python files? (using
Tools/scripts/reindent.py)
●Are there any whitespace problems in C files?
●Are there any whitespace problems in the documentation?
(using Tools/scripts/reindent-rst.py)
●Has the documentation been updated?
●Has the test suite been updated?
●Has an entry under Misc/NEWS.d/next been added?
(using blurb-it,
or the blurb tool)
●Has Misc/ACKS been updated?
●Has configure been regenerated, if necessary?
●Has pyconfig.h.in been regenerated, if necessary?
The automated patch check doesn’t actually answer all of these
questions. Aside from the whitespace checks, the tool is
a memory aid for the various elements that can go into
making a complete patch.
bpo-42: Make the spam module more spammy (GH-NNNN) The spam module sporadically came up short on spam. This change raises the amount of spam in the module by making it more spammy.The first line or sentence is meant to be a dense, to-the-point explanation of what the purpose of the commit is. The imperative form (used in the example above) is strongly preferred to a descriptive form such as ‘the spam module is now more spammy’. Use
git log --oneline to see existing title lines.
Furthermore, the first line should not end in a period.
If this is not enough detail for a commit, a new paragraph(s) can be added
to explain in proper depth what has happened (detail should be good enough
that a core developer reading the commit message understands the
justification for the change).
Check the git bootcamp for further
instructions on how the commit message should look like when merging a pull
request.
Note
How to Write a Git Commit Message
is a nice article that describes how to write a good commit message.
git commit -a and
that will commit everything. You can always run git status to see
what changes are outstanding.
When all of your changes are committed (i.e. git status doesn’t
list anything), you will want to push your branch to your fork:
git push origin <branch name>This will get your changes up to GitHub. Now you want to create a pull request from your fork. If this is a pull request in response to a pre-existing issue on the issue tracker, please make sure to reference the issue number using
bpo-NNNN in the pull request title or message.
If this is a pull request for an unreported issue (assuming you already
performed a search on the issue tracker for a pre-existing issue), create a
new issue and reference it in the pull request. Please fill in as much
relevant detail as possible to prevent reviewers from having to delay
reviewing your pull request because of lack of information.
If this issue is so simple that there’s no need for an issue to track
any discussion of what the pull request is trying to solve (e.g. fixing a
spelling mistake), then the pull request needs to have the “skip issue” label
added to it by someone with commit access.
Your pull request may involve several commits as a result of addressing code
review comments. Please keep the commit history in the pull request intact by
not squashing, amending, or anything that would require a force push to GitHub.
A detailed commit history allows reviewers to view the diff of one commit to
another so they can easily verify whether their comments have been addressed.
The commits will be squashed when the pull request is merged.
Misc/ACKS file (and, most
often, in a contribution’s news entry as well). You may be
asked to make these edits on the behalf of the core developer who
accepts your pull request.
patchcheck
●3.6. Making Good Commits
●3.7. Licensing
●3.8. Submitting
●3.9. Converting an Existing Patch from b.p.o to GitHub
●3.10. Reviewing
●3.10.1. How to Review a Pull Request
●3.11. Leaving a Pull Request Review on GitHub
●3.12. Dismissing Review from Another Core Developer
●3.13. Committing/Rejecting
●3.14. Crediting
patchcheck
●3.6. Making Good Commits
●3.7. Licensing
●3.8. Submitting
●3.9. Converting an Existing Patch from b.p.o to GitHub
●3.10. Reviewing
●3.10.1. How to Review a Pull Request
●3.11. Leaving a Pull Request Review on GitHub
●3.12. Dismissing Review from Another Core Developer
●3.13. Committing/Rejecting
●3.14. Crediting
●4. Running & Writing Tests
●5. Increase Test Coverage
●6. Helping with Documentation
●7. Documenting Python
●8. Silence Warnings From the Test Suite
●9. Fixing “easy” Issues (and Beyond)
●10. Issue Tracking
●11. Triaging an Issue
●12. Following Python’s Development
●13. Porting Python to a new platform
●14. How to Become a Core Developer
●15. Developer Log
●16. Accepting Pull Requests
●17. Development Cycle
●18. Continuous Integration
●19. Adding to the Stdlib
●20. Changing the Python Language
●21. Experts Index
●22. gdb Support
●23. Exploring CPython’s Internals
●24. Changing CPython’s Grammar
●25. Design of CPython’s Compiler
●26. Design of CPython’s Garbage Collector
●27. Updating standard library extension modules
●28. Coverity Scan
●29. Dynamic Analysis with Clang
●30. Running a buildbot worker
●31. Core Developer Motivations and Affiliations
●32. Git Bootcamp and Cheat Sheet
●33. Appendix: Topics
●Python »
Python Developer's Guide »