Repository navigation
adding pullrequest guide for #103 #140
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
Changes from 1 commit
9e3cc06
b62d78d
21b4960
0b68c42
523b77f
e0aac2a
24149d3
044dc08
ca8e9c1
a3ddf1c
a6b773c
ab07aef
cebd349
2b468f7
36eb29b
1ae31e5
9865ccf
2a7bb10
a37d2e6
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 |
|---|---|---|
|
|
@@ -93,6 +93,89 @@ command (after any successful build of Python):: | |
| python.bat Tools/scripts/patchcheck.py | ||
|
|
||
|
|
||
| Quick Guide | ||
| ''''''''''' | ||
|
|
||
| `Clear communication`_ is key to contributing to any project, especially an | ||
| `Open Source`_ project like Python. | ||
|
|
||
| Here is a quick overview of you can contribute to CPython on Github: | ||
|
|
||
| 1. `Create an Issue`_ that describes your change, if it doesn't exist and you're explicitly working on something | ||
|
Collaborator
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.
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.
Contributor
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. Clearer. Thanks @ezio-melotti and @willingc |
||
|
|
||
| 2. `Get started`_ and set up your system | ||
|
|
||
| 3. Fork `CPython on Github`_ (using the Fork button in the upper-right on Github) | ||
|
|
||
| 4. `Compile Python`_ on your system | ||
|
|
||
| 5. `Run tests`_ after you have built Python | ||
|
|
||
| 6. `Add an "upstream" Remote in Git`_ on your system | ||
|
Collaborator
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. Suggestion: |
||
|
|
||
| 7. `Create a Branch in Git`_ where you can work on changes | ||
|
|
||
| 8. Commit changes and `resolve conflicts in Git`_ | ||
|
|
||
| 9. `Run tests`_ again | ||
|
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. I think this should be between 7 and 8: after creating the branch, the user should fix the issue and run the tests to make sure the fix works. If it works, the changes can be committed.
Contributor
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. Good catch. I meant to do just that |
||
|
|
||
| 10. `Push commits`_ to your Github repo | ||
|
|
||
| 11. `Create Pull Request`_ in Github to merge a branch from your Fork | ||
|
Collaborator
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.
|
||
|
|
||
| 12. Celebrate! You just contributed to Python. :) | ||
|
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. Perhaps before celebrating the user should address the review comments and update the PR until it gets merged.
Contributor
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. You're telling me! Haha |
||
|
|
||
| .. _Clear communication: https://opensource.guide/how-to-contribute/#how-to-submit-a-contribution | ||
| .. _Open Source: https://opensource.guide/ | ||
| .. _Create an Issue: https://bugs.python.org/ | ||
| .. _Get started: https://cpython-devguide.readthedocs.io/setup.html#getting-started | ||
| .. _CPython on Github: https://github.com/python/cpython | ||
| .. _Compile Python: https://cpython-devguide.readthedocs.io/setup.html#compiling-for-debugging | ||
| .. _Run tests: https://cpython-devguide.readthedocs.io/runtests.html#running-writing-tests | ||
| .. _Add an "upstream" Remote in Git: https://cpython-devguide.readthedocs.io/committing.html#remotes-setup | ||
| .. _Create a Branch in Git: https://cpython-devguide.readthedocs.io/committing.html#active-branches | ||
| .. _resolve conflicts in Git: https://cpython-devguide.readthedocs.io/committing.html#squashing-commits | ||
| .. _Run tests: https://cpython-devguide.readthedocs.io/runtests.html#running-writing-tests | ||
| .. _Push commits: https://cpython-devguide.readthedocs.io/committing.html#pushing-changes | ||
|
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. For all the internal links you should be able to use
Contributor
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. Can you elaborate on ""For all the internal links you should be able to use :ref:
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. See for example the quick start in index.rst -- it links to other sections using this syntax.
Contributor
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'm not sure I follow. This appears to be internal linking within a page whereas I'm linking within the same site, but to different pages. Perhaps I don't understand the full scope of what :ref: is doing for devguide.
Contributor
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. Okay. I think I've got it... but where can I find an index of each of these unique IDs across devguide? Is there one, or can Sphinx create it for me? I want to avoid name collision.
Contributor
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. Plus, I'm finding it difficult to do "ACTIVE VERB" -- GET, DO, RUN, versus the current titles which are like Getting, Doing, Running. They work fine as headers, but are tough for step-by-step instructions that say, "Do step 1."; "Run step 2" and so on
Contributor
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. Sorry for continued complaints, as this might be a known issue. I've updated the devguide with internal
Contributor
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. Note that when the auto-generated text for a link target doesn't make sense in the context of the particular link, you can instead use: The description at https://cpython-devguide.readthedocs.io/documenting.html#cross-linking-markup mentions using that syntax for linking to labels that don't refer to section headings, but doesn't point out that it can also be used to link to section headings with text other than the section heading name.
Contributor
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. As far as name collisions are concerned, I don't know of an easy way to get a complete listing, but Sphinx itself will complain about any duplicates (and tell you which files contain the conflicting labels) as part of the build process.
Contributor
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. Thank you, @ncoghlan That is super-helpful. |
||
| .. _Create Pull Request: https://help.github.com/articles/creating-a-pull-request/ | ||
|
|
||
|
|
||
| Quick Guide Step-by-step | ||
| '''''''''''''''''''''''' | ||
|
|
||
| Set up your system:: | ||
|
Collaborator
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. This will only work if the user has an ssh key setup for GitHub. Otherwise, the user will need to use https.
Contributor
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'm re-reading this part. How often to contributors not have an SSH / RSA key? To me, that seems standard.
Collaborator
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. @louisrawlins It's worth mentioning the SSH key since my experience at sprints and hackathons is that many new contributors do not have an SSH key configured for GitHub.
Contributor
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. Aha. Gotcha. Hadn't considered hackathons and that environment. |
||
|
|
||
| git clone git@github.com:YOUR_GITHUB_ID/cpython.git | ||
|
|
||
| Replace **YOUR_GITHUB_ID** with your Github account name above, then add upstream:: | ||
|
|
||
| git remote add upstream git://github.com/python/cpython.git | ||
|
Collaborator
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. This should probably be the https url since a contributor would need core dev privileges, as well as an ssh key, to use the git url.
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. Agreed, but I would also add a short note to explain the difference, otherwise users might be wondering why two different types of urls are used.
Contributor
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. Yeah. I'm struggling to figure out a way to say that concisely. It's like, you're cloning SSH, then fetching HTTPS -- I suppose?
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. #130 has a discussion about it that clarifies the differences.
Contributor
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'm not so much curious about the difference, as I'm trying to figure out how to tell potentially contributors when they might need to worry about the difference. For me, I treat HTTPS as something I use when I just need to download something as a ZIP, I'm not at my machine, etc. It's not something I'd be using if I'm branching something on my repo and preparing for a Pull Request. For that, I'd use SSH. But perhaps I'm missing a nuance here.
Contributor
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. How about "Add an “upstream” Git remote on your system (for SSH, or you can use HTTPS)"? |
||
|
|
||
| Work on new features or fixes:: | ||
|
|
||
| git checkout -b MY_NEW_FEATURE upstream/master | ||
|
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. I would use something more generic, such as |
||
|
|
||
| As you work, please create a separate commit for each bug fix or feature change:: | ||
|
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. This might be a bit misleading, since each PR should either fix a bug or add a new feature. |
||
|
|
||
| git commit | ||
|
|
||
| Then fetch upstream to see if anything conflicts with your changes:: | ||
|
|
||
| git fetch upstream | ||
|
|
||
| Use rebase -i to verify what you commit and squish small commits:: | ||
|
Collaborator
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. /s/squish/squash |
||
|
|
||
| git rebase -i upstream/master | ||
|
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. Is this step necessary?
Contributor
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. What do you think? I'm not sure. This came from a workflow where many devs were contributing to a single remote branch, then the dev lead would merge that branch to production periodically. Since I'm not contributing to the CPython codebase day-to-day, it's hard for me to judge
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. The squash seems unnecessary, especially if it "hides" the intermediate commits.
Contributor
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.
Collaborator
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 tend to lean toward @ezio-melotti's approach to not rebase since the core dev will take care of it. @louisrawlins, In my experience contributors vary widely in their understanding of rebase, so let's keep things easiest and not recommend. Thanks. |
||
|
|
||
| Then push your work to your clone on Github:: | ||
|
|
||
| git push origin MY_NEW_FEATURE | ||
|
|
||
| When you're ready, make a Pull Request on Github and refer to your branch named **MY_NEW_FEATURE**. | ||
|
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. The contributors should be ready as soon as they pushed their branch :)
Contributor
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. As far as I know, there is that extra step where I have to go to [CPython on GitHub] (https://github.com/python/cpython), click "New pull request", find and click on the link "compare across forks", select my repository, THEN select my branch -- I find the entire process burdensome (because I'm doing everything else on the CLI) and a bit confusing because it's its own process -- how much detail should we have in the docs?
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. What I did so far was:
IOW, I create the PR from my fork, not from the upstream CPython.
Collaborator
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. If you go to your fork, the GitHub UI should pop up the option to submit a PR as @ezio-melotti recommends.
Contributor
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. Okay. Clearer. It's the "New pull request" button next to the "branch selection" menu in my repo, correct? Glad I asked! (To be clear, I wasn't creating the PR from the upstream, but rather going TO CPython because I had a Pull Request FOR CPython -- it didn't make sense to fiddle with a PR from my own repo.) |
||
|
|
||
| *Though submitting a Pull Request on Github is the preferred method of contribution, you can alternatively upload a patch to bugs.python.org* | ||
|
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. This line (and perhaps the previous one) is too long. Add
Contributor
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. Having emphasis |
||
|
|
||
|
|
||
| Licensing | ||
| --------- | ||
|
|
||
|
|
||
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.
Substitute
GitHubfor all instances ofGithub👍