Skip to content

Commit 192ce4b

Browse files
Updating pandas pull request guide, with sending the PR directly to pandas, and with information about updating the pull request
1 parent 18cf7ba commit 192ce4b

File tree

4 files changed

+149
-48
lines changed

4 files changed

+149
-48
lines changed

pandas/guide/_sources/pandas_pr.rst.txt

Lines changed: 50 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,23 @@ execute in your terminal:
2121
where `<your-function-or-method>` is for example `pandas.DataFrame.head`,
2222
`pandas.Series.tail` or `pandas.to_datetime`.
2323

24+
The output of the script will show the final docstring. In many cases just a
25+
verbatim copy, but in some cases the docstring is implemented as a template,
26+
and reused by more than one method or function, and this is useful to see
27+
the final result.
28+
29+
The output will also contain a list of issues with the docstring. Mainly style
30+
errors, where the docstring does not respect the convention. For example, a
31+
missing dot at the end of a sentence, a blank line where it should not be, etc.
32+
33+
Finally, the output will also contain errors from running the examples.
34+
35+
With few exceptions, you should fix all the errors before continuing.
36+
2437
2. Visual validation of the docstring
2538
-------------------------------------
2639

27-
The previous script validates things like the names of the sections, or
40+
The previous sprint validates things like the names of the sections, or
2841
that there are dots, spaces, or blank lines in the right side. But does
2942
not validate for typos, unclear sentences, or other mistakes. To validate
3043
them, as well as the visualization of your docstring in the pandas website
@@ -45,8 +58,8 @@ that can be opened with your web browser.
4558
-------------------------------------------------
4659

4760
As the last validation, please show the html version of your docstring to a
48-
person in the sprint not involved in the changes to the docstring, and make
49-
sure they are able to fully understand it.
61+
person in the sprint not involved in the changes to that specific docstring,
62+
and make sure they are able to fully understand it.
5063

5164
4. Commit your changes
5265
----------------------
@@ -59,6 +72,10 @@ you are going to commit with:
5972

6073
| ``git branch``
6174
75+
If the current branch is `master`, do not commit your changes, as you can get
76+
into a situation where you need to undo your history in git, which is not
77+
straight forward.
78+
6279
Then, follow the next steps:
6380

6481
| ``git fetch upstream``
@@ -69,40 +86,47 @@ Then, follow the next steps:
6986
where `<modified-file(s)>` is the file where you made your changes (in rare
7087
cases it could be more than one file). And `<commit-message>` is a short
7188
description of your changes, starting by "DOC:" (e.g. "DOC: Improved the
72-
docstring of DataFrame.head()").
89+
docsting of DataFrame.head()").
7390

74-
5. Push your changes to the pandas repository
75-
---------------------------------------------
91+
5. Push your changes to pandas
92+
------------------------------
7693

77-
You are now ready to send a pull request to the pandas repository, to get your
78-
changes reviewed.
94+
Once you committed your changes locally, you need to make them available to
95+
pandas maintainers, so they can add them to the main pandas repository.
7996

80-
First, push your changes to your GitHub fork:
97+
The first step is to push your local changes to your own fork, so they are
98+
available online:
8199

82100
| ``git push -u origin <your-branch-name>``
83101
84-
Then, visit https://github.com/pandas-dev/pandas in your browser, and click
102+
Then, visit https://github.com/python-sprints/pandas in your browser, and click
85103
on the "Compare & pull request" button in the yellow box above the repository
86104
files.
87105

88-
6. Update your pull request based on feedback
89-
---------------------------------------------
106+
This will create a pull request, will be reviewed by other developers. It is
107+
unlikely that a pull request is accepted in its first version, so expect some
108+
comments on things that can be improved, from more senior pandas contributors.
90109

91-
The pull request will be reviewed by other sprint participants and pandas
92-
developers. Based on those discussions, you might need to make additional
93-
changes. After making those changes, make sure to again validate the docstring
94-
(steps 1-3).
110+
For comments in your review, you can make new changes in your local branch for
111+
that pull request. And once you addressed all the comments, you can commit them
112+
and push again to your local branch. As you used the parameter `-u` in your
113+
first push, you can simply run:
95114

96-
To update the pull request, you can commit the changes and push again to
97-
github. The pull request will automatically be updated:
115+
| ``git push``
98116
99-
| ``git add <modified-file(s)>``
100-
| ``git commit -m "<commit-message>"``
101-
| ``git push -u origin <your-branch-name>``
117+
from your local branch, and the changes will be pushed to your remote branch.
118+
119+
Updating your remote branch automatically updates the pull request, so you do
120+
not need to create a new pull request, or make any other changes in the one
121+
already created.
102122

103-
`<commit-message>` can now be a short indication of what has been updated
104-
(e.g. "clarified the extended summary" or simply "updates based on feedback").
123+
If you want to add any clarification to your changes, or you think the reviewer
124+
misunderstood something, you can add a comment to the pull request.
105125

106-
Once the reviewers are happy with the changes, a pandas developer will
107-
merge your pull request (this may take some time when many pull requests
108-
are opened during the sprint, so be patient with this).
126+
Do not feel discouraged by having more than one review requesting changes for
127+
the same pull request. While in the first contributions is normal to feel
128+
frustrated for getting feedback requesting changes, it is actually because of
129+
reviews that the open source software quality is very high. And also, it is
130+
probably the part of contributing to open source projects in which you will
131+
learn more. So, be patient and enjoy. And feel free to provide constructive
132+
feedback in other contributors pull requests too.

pandas/guide/pandas_pr.html

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ <h2>1. Validate that your docstring does not have technical errors<a class="head
5757
</div></blockquote>
5858
<p>where <cite>&lt;your-function-or-method&gt;</cite> is for example <cite>pandas.DataFrame.head</cite>,
5959
<cite>pandas.Series.tail</cite> or <cite>pandas.to_datetime</cite>.</p>
60+
<p>The output of the script will show the final docstring. In many cases just a
61+
verbatim copy, but in some cases the docstring is implemented as a template,
62+
and reused by more than one method or function, and this is useful to see
63+
the final result.</p>
64+
<p>The output will also contain a list of issues with the docstring. Mainly style
65+
errors, where the docstring does not respect the convention. For example, a
66+
missing dot at the end of a sentence, a blank line where it should not be, etc.</p>
67+
<p>Finally, the output will also contain errors from running the examples.</p>
68+
<p>With few exceptions, you should fix all the errors before continuing.</p>
6069
</div>
6170
<div class="section" id="visual-validation-of-the-docstring">
6271
<h2>2. Visual validation of the docstring<a class="headerlink" href="#visual-validation-of-the-docstring" title="Permalink to this headline"></a></h2>
@@ -80,8 +89,8 @@ <h2>2. Visual validation of the docstring<a class="headerlink" href="#visual-val
8089
<div class="section" id="validate-that-the-docstring-is-clear-to-others">
8190
<h2>3. Validate that the docstring is clear to others<a class="headerlink" href="#validate-that-the-docstring-is-clear-to-others" title="Permalink to this headline"></a></h2>
8291
<p>As the last validation, please show the html version of your docstring to a
83-
person in the sprint not involved in the changes to the docstring, and make
84-
sure they are able to fully understand it.</p>
92+
person in the sprint not involved in the changes to that specific docstring,
93+
and make sure they are able to fully understand it.</p>
8594
</div>
8695
<div class="section" id="commit-your-changes">
8796
<h2>4. Commit your changes<a class="headerlink" href="#commit-your-changes" title="Permalink to this headline"></a></h2>
@@ -94,6 +103,9 @@ <h2>4. Commit your changes<a class="headerlink" href="#commit-your-changes" titl
94103
<div class="line"><code class="docutils literal"><span class="pre">git</span> <span class="pre">branch</span></code></div>
95104
</div>
96105
</div></blockquote>
106+
<p>If the current branch is <cite>master</cite>, do not commit your changes, as you can get
107+
into a situation where you need to undo your history in git, which is not
108+
straight forward.</p>
97109
<p>Then, follow the next steps:</p>
98110
<blockquote>
99111
<div><div class="line-block">
@@ -108,12 +120,12 @@ <h2>4. Commit your changes<a class="headerlink" href="#commit-your-changes" titl
108120
description of your changes, starting by “DOC:” (e.g. “DOC: Improved the
109121
docsting of DataFrame.head()”).</p>
110122
</div>
111-
<div class="section" id="push-your-changes-to-the-sprint-repository">
112-
<h2>5. Push your changes to the sprint repository<a class="headerlink" href="#push-your-changes-to-the-sprint-repository" title="Permalink to this headline"></a></h2>
113-
<p>Before sending the pull request to the pandas core developers, you will send
114-
it to the sprint repository. Where more experienced contributors will review
115-
it, and suggest changes if needed.</p>
116-
<p>First, push your changes to your GitHub fork:</p>
123+
<div class="section" id="push-your-changes-to-pandas">
124+
<h2>5. Push your changes to pandas<a class="headerlink" href="#push-your-changes-to-pandas" title="Permalink to this headline"></a></h2>
125+
<p>Once you committed your changes locally, you need to make them available to
126+
pandas maintainers, so they can add them to the main pandas repository.</p>
127+
<p>The first step is to push your local changes to your own fork, so they are
128+
available online:</p>
117129
<blockquote>
118130
<div><div class="line-block">
119131
<div class="line"><code class="docutils literal"><span class="pre">git</span> <span class="pre">push</span> <span class="pre">-u</span> <span class="pre">origin</span> <span class="pre">&lt;your-branch-name&gt;</span></code></div>
@@ -122,8 +134,31 @@ <h2>5. Push your changes to the sprint repository<a class="headerlink" href="#pu
122134
<p>Then, visit <a class="reference external" href="https://github.com/python-sprints/pandas">https://github.com/python-sprints/pandas</a> in your browser, and click
123135
on the “Compare &amp; pull request” button in the yellow box above the repository
124136
files.</p>
125-
<p>Once your changes are reviewed and approved, you will receive an email on how
126-
to send the final pull request to pandas.</p>
137+
<p>This will create a pull request, will be reviewed by other developers. It is
138+
unlikely that a pull request is accepted in its first version, so expect some
139+
comments on things that can be improved, from more senior pandas contributors.</p>
140+
<p>For comments in your review, you can make new changes in your local branch for
141+
that pull request. And once you addressed all the comments, you can commit them
142+
and push again to your local branch. As you used the parameter <cite>-u</cite> in your
143+
first push, you can simply run:</p>
144+
<blockquote>
145+
<div><div class="line-block">
146+
<div class="line"><code class="docutils literal"><span class="pre">git</span> <span class="pre">push</span></code></div>
147+
</div>
148+
</div></blockquote>
149+
<p>from your local branch, and the changes will be pushed to your remote branch.</p>
150+
<p>Updating your remote branch automatically updates the pull request, so you do
151+
not need to create a new pull request, or make any other changes in the one
152+
already created.</p>
153+
<p>If you want to add any clarification to your changes, or you think the reviewer
154+
misunderstood something, you can add a comment to the pull request.</p>
155+
<p>Do not feel discouraged by having more than one review requesting changes for
156+
the same pull request. While in the first contributions is normal to feel
157+
frustrated for getting feedback requesting changes, it is actually because of
158+
reviews that the open source software quality is very high. And also, it is
159+
probably the part of contributing to open source projects in which you will
160+
learn more. So, be patient and enjoy. And feel free to provide constructive
161+
feedback in other contributors pull requests too.</p>
127162
</div>
128163
</div>
129164

@@ -143,7 +178,7 @@ <h3><a href="contents.html">Table Of Contents</a></h3>
143178
<li><a class="reference internal" href="#visual-validation-of-the-docstring">2. Visual validation of the docstring</a></li>
144179
<li><a class="reference internal" href="#validate-that-the-docstring-is-clear-to-others">3. Validate that the docstring is clear to others</a></li>
145180
<li><a class="reference internal" href="#commit-your-changes">4. Commit your changes</a></li>
146-
<li><a class="reference internal" href="#push-your-changes-to-the-sprint-repository">5. Push your changes to the sprint repository</a></li>
181+
<li><a class="reference internal" href="#push-your-changes-to-pandas">5. Push your changes to pandas</a></li>
147182
</ul>
148183
</li>
149184
</ul>

0 commit comments

Comments
 (0)