-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Move the "quick reference" to a dedicated page #1838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9a62b60
543e002
fec3bf3
cdc0df0
5e7e09e
86f942c
1a76f5e
09e61f7
a908456
1931332
608a224
85825ba
7f14dbc
e54a2bb
0265531
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ Getting started | |
| .. toctree:: | ||
| :maxdepth: 5 | ||
|
|
||
| quick-reference | ||
| setup-building | ||
| fixing-issues | ||
| git-boot-camp | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,58 +16,8 @@ that you create a branch in Git, make your changes, push those changes | |
| to your fork on GitHub (``origin``), and then create a pull request against | ||
| the official CPython repository (``upstream``). | ||
|
|
||
|
|
||
| .. _pullrequest-quickguide: | ||
|
|
||
| Quick guide | ||
| =========== | ||
|
|
||
| `Clear communication`_ is key to contributing to any project, especially an | ||
| `Open Source`_ project like CPython. | ||
|
|
||
| Here is a quick overview of how you can contribute to CPython: | ||
|
|
||
| #. `Create an issue`_ that describes your change. If it is trivial | ||
| (like :ref:`typo fixes <typo-fixes>`), or an issue already exists, | ||
| you can skip this step. | ||
|
|
||
| #. :ref:`Create a new branch in Git <pullrequest-steps>` from the | ||
| ``main`` branch | ||
|
|
||
| #. Work on changes: fix a bug or add a new feature | ||
|
|
||
| #. :ref:`Run tests <runtests>` and ``make patchcheck`` | ||
|
|
||
| #. :ref:`Commit <commit-changes>` and :ref:`push <push-changes>` | ||
| changes to your GitHub fork | ||
|
|
||
| #. `Create Pull Request`_ on GitHub to merge a branch from your fork | ||
|
|
||
| #. Make sure the :ref:`continuous integration checks on your Pull Request | ||
| are green <keeping-ci-green>` (successful) | ||
|
|
||
| #. Review and address `comments on your Pull Request`_ | ||
|
|
||
| #. When your changes are merged, you can :ref:`delete the PR branch | ||
| <deleting_branches>` | ||
|
|
||
| #. Celebrate contributing to CPython! :) | ||
|
|
||
| Don't force-push | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why drop this section? We have linked to it in many comments at this point, this will break a large amount of references.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm. We have a copied, near-identical version of it in the new guide, but that won't help with links to this page... What about reintroducing it below, before or after "Resolving merge conflicts"? I've been trying to remove duplicate docs, but this seems like something that should stay on this page too.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I went ahead and pushed this -- after my prior comment I started to feel confident that this is the right improvement. |
||
| ---------------- | ||
|
|
||
| In order to keep the commit history intact, please avoid squashing or amending | ||
| history and then force-pushing to the PR. Reviewers often want to look at | ||
| individual commits. | ||
| When the PR is merged, everything will be squashed into a single commit. | ||
|
|
||
| .. _Clear communication: https://opensource.guide/how-to-contribute/#how-to-submit-a-contribution | ||
| .. _Open Source: https://opensource.guide/ | ||
| .. _create an issue: https://github.com/python/cpython/issues | ||
| .. _CPython: https://github.com/python/cpython | ||
| .. _use HTTPS: https://help.github.com/articles/which-remote-url-should-i-use/ | ||
| .. _Create Pull Request: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request | ||
| .. _comments on your Pull Request: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/commenting-on-a-pull-request | ||
| For a cheat-sheet reference, see the | ||
| :ref:`quick reference on creating pull requests <pullrequest-quickguide>`. | ||
|
|
||
|
|
||
| .. _pullrequest-steps: | ||
|
|
@@ -185,6 +135,15 @@ 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. | ||
|
|
||
| Don't force-push | ||
| ---------------- | ||
|
|
||
| In order to keep the commit history intact, avoid squashing or amending | ||
| history and then force-pushing to the PR. | ||
| Reviewers often want to look at individual commits. | ||
|
|
||
| CPython uses squash merges, so PRs will end up as single commits when merged. | ||
|
|
||
|
|
||
| .. _good-prs: | ||
|
|
||
|
|
@@ -290,13 +249,20 @@ in the "What's New in Python" entry. | |
| A change that needs an entry in "What's New in Python" | ||
| is very likely not suitable for inclusion in a maintenance release. | ||
|
|
||
| .. _news-entry-howto: | ||
|
|
||
| How to add a NEWS entry | ||
| ----------------------- | ||
|
|
||
| ``NEWS`` entries go into the ``Misc/NEWS.d`` directory as individual files. The | ||
| ``NEWS`` entry can be created by using `blurb-it <https://blurb-it.herokuapp.com/>`_, | ||
| or the :pypi:`blurb` tool and its ``blurb add`` command. | ||
|
|
||
| .. tip:: | ||
|
|
||
| You can read more about ``blurb`` in its | ||
| :github:`repository <python/blurb>`. | ||
|
|
||
| If you are unable to use the tool, then you can create the ``NEWS`` entry file | ||
| manually. The ``Misc/NEWS.d`` directory contains a sub-directory named | ||
| ``next``, which contains various sub-directories representing classifications | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| .. _quick-reference: | ||
|
|
||
| =============== | ||
| Quick reference | ||
| =============== | ||
|
sirosen marked this conversation as resolved.
|
||
|
|
||
| .. include:: /include/activate-tab.rst | ||
|
|
||
| Here are the basic steps needed to get set up and open a pull request. | ||
|
|
||
| This is meant as a checklist and cheat-sheet, not a comprehensive guide. | ||
| For complete instructions see the :ref:`setup guide <setup>` and the | ||
| :ref:`pull request guide <pullrequest>`. | ||
|
|
||
|
|
||
| Set up Git | ||
| ========== | ||
|
|
||
| Install and set up ``Git``. | ||
|
|
||
| For detailed setup information, see :ref:`"Install Git" <vcsetup>`. | ||
| There is also a more detailed :ref:`Git guide and cheat sheet <gitbootcamp>`. | ||
|
|
||
| Fork and clone the repo | ||
| ----------------------- | ||
|
|
||
| Fork `the CPython repository <https://github.com/python/cpython>`__ | ||
| to your GitHub account and clone the repo using:: | ||
|
|
||
| git clone https://github.com/<your_username>/cpython | ||
| cd cpython | ||
|
|
||
| For detailed information, see :ref:`"Get the source code" <checkout>`. | ||
|
|
||
|
|
||
| Build Python | ||
| ============ | ||
|
|
||
| .. tab:: Unix | ||
|
|
||
| .. code-block:: shell | ||
|
|
||
| ./configure --config-cache --with-pydebug && make -j $(nproc) | ||
|
|
||
| .. tab:: macOS | ||
|
|
||
| .. code-block:: shell | ||
|
|
||
| ./configure --config-cache --with-pydebug && make -j$(sysctl -n hw.logicalcpu) | ||
|
|
||
| .. tab:: Windows | ||
|
|
||
| .. code-block:: dosbatch | ||
|
|
||
| PCbuild\build.bat -e -d | ||
|
|
||
| See also :ref:`more detailed instructions <compiling>`, | ||
| :ref:`how to install and build dependencies <build-dependencies>`, | ||
| and the platform-specific pages for :ref:`Unix <unix-compiling>`, | ||
| :ref:`macOS <macOS>`, and :ref:`Windows <windows-compiling>`. | ||
|
|
||
|
|
||
| Run the tests | ||
| ============= | ||
|
|
||
| .. tab:: Unix | ||
|
|
||
| .. code-block:: shell | ||
|
|
||
| ./python -m test -j0 | ||
|
|
||
| .. tab:: macOS | ||
|
|
||
| .. code-block:: shell | ||
|
|
||
| ./python.exe -m test -j0 | ||
|
|
||
| .. note:: | ||
| :ref:`Most <mac-python.exe>` macOS systems use | ||
| :file:`./python.exe` in order to avoid filename conflicts with | ||
| the ``Python`` directory. | ||
|
StanFromIreland marked this conversation as resolved.
|
||
|
|
||
| .. tab:: Windows | ||
|
|
||
| .. code-block:: dosbatch | ||
|
|
||
| .\python.bat -m test -j0 | ||
|
|
||
|
|
||
| See also :ref:`how to write and run tests <run-write-tests>`. | ||
|
|
||
|
|
||
| .. _pullrequest-quickguide: | ||
|
|
||
| Create issues and pull requests | ||
| =============================== | ||
|
|
||
| Create issues for nontrivial changes | ||
| ------------------------------------ | ||
|
|
||
| For most changes, `create an issue <https://github.com/python/cpython/issues>`__ | ||
| before submitting a pull request. | ||
| Trivial changes like typo fixes do not need issues. | ||
|
|
||
| Create work branches | ||
| -------------------- | ||
|
|
||
| Work on a feature or fix in a new branch in Git from the ``main`` branch:: | ||
|
|
||
| git checkout -b fix-issue-12345 main | ||
|
|
||
| Make changes, then :ref:`commit <commit-changes>` and | ||
| :ref:`push to your fork <push-changes>`. | ||
|
|
||
| Document your changes | ||
| --------------------- | ||
|
|
||
| Many changes deserve a NEWS entry which documents what changed. | ||
| For more information on how and when to write news entries, | ||
| see :ref:`"Updating NEWS and What's New in Python" <news-entry>`. | ||
|
|
||
| A news entry can be created locally with the :pypi:`blurb` tool | ||
| and its ``blurb add`` command or online after a pull request has | ||
| been opened with `blurb-it <https://blurb-it.herokuapp.com/>`__. | ||
|
|
||
| For more information about how to create news entries, see | ||
| :ref:`"How to add a NEWS entry" <news-entry-howto>`. | ||
|
|
||
| Create pull requests | ||
| -------------------- | ||
|
|
||
| Create pull requests on GitHub from your branches, on your fork, and make sure | ||
| to put the relevant issue number in ``gh-NNNNNN`` format in the pull request title. | ||
| For example: | ||
|
|
||
| .. code-block:: text | ||
|
|
||
| gh-12345: Fix some bug in spam module | ||
|
|
||
| See also, GitHub's documentation on `creating pull requests`_. | ||
|
|
||
| For more detailed guidance, follow the :ref:`step-by-step pull request guide <pullrequest-steps>`. | ||
|
|
||
| .. note:: | ||
|
|
||
| First time contributors will need to sign the Contributor Licensing | ||
| Agreement (CLA) as described in the :ref:`Licensing <cla>` section of | ||
| this guide. | ||
|
|
||
| .. _creating pull requests: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request | ||
|
|
||
| Work on your pull request | ||
| ------------------------- | ||
|
|
||
| Make sure the :ref:`continuous integration checks on your pull | ||
| request are green <keeping-ci-green>` (successful). | ||
|
|
||
| Read and respond to reviewer comments on your pull request. | ||
|
|
||
| See also, GitHub's documentation on `commenting on pull requests`_. | ||
|
|
||
| .. _commenting on pull requests: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/commenting-on-a-pull-request | ||
|
|
||
| Don't force-push | ||
| ---------------- | ||
|
|
||
| In order to keep the commit history intact, avoid squashing or amending | ||
| history and then force-pushing to the PR. | ||
| Reviewers often want to look at individual commits. | ||
|
|
||
| CPython uses squash merges, so PRs will end up as single commits when merged. | ||
Uh oh!
There was an error while loading. Please reload this page.