Require a problem description in PRs
State: closed

A lot of time I can't find out why a change in a commit was made because it either has no proper commit message or the commit message just says what was changed, but not why. 

Add text to the PR template to require such a problem description, so that one can comprehend why a change was made even years later.


Labels:

Comments:
@janschulz the issue templates could be better of course, but they generally don't end up as the actual commit message. They are referenced by number. So if that is what you mean ok.

sorry meant this on your other PR. sure this can be better.

@jreback as this repo squashes all commits, I think this is the only place where such a problem description makes sense? Or do you have a script which does not take the initial PR message into account?

Just giving an example why I think such a description is nice (I just took the latest commit at the time of writing this; sorry @sinhrks that it's one of yours, a lot of others look the same):

```
TST: Fix test_coercion for period dtype
xref #13941.

Author: sinhrks <sinhrks@gmail.com>

Closes #14025 from sinhrks/test_coercion_period and squashes the following commits:

b873683 [sinhrks] TST: Fix test_coercion for period dtype
```

This actually gives no idea what was wrong here and why the new behaviour is the right one. The original commit only has a message ("TST: Fix test_coercion for period dtype"), no description; the PR  #14025 has basically no explaination at all; the xrefed issue is actually another PR (https://github.com/pydata/pandas/pull/13941) which also has also no clean description what the problem is and only mentioned that it is "split from https://github.com/pydata/pandas/pull/13755" which then mentions what has to be done to get that PR merged, but again has no mention what the actual problem is whch that PR tries to fix.

I'm not sure how you know why all this changes are needed and what the context is, but for me as an outside contributor is not clear at all why changes are done, especially when looking at the changes half year or more later. During the Categorical fixes, I spent quite a lot of time trying to understand why changes were done ("Is that behaviour really just by accident or is that by design") and in most of the cases I found only such uninformative commit messages as above :-(

IMO to make decisions/changes more comprehensible (and also to make it easier for newcomers to understand things) it would be nice if changes could be better documented in the actual commits.

@janschulz I do this on purpose. Otherwise these comments just clutter the git log. There is the issue reference. Anything else is just superflous.

This one was an [accident](https://github.com/pydata/pandas/commit/3760f169a9a15f7ae61154c978b544ef8dca15bd).

I actually find the PR templates are pretty much useless and always remove them. The purpose is to remind contributors, which _maybe_ helps a little.

Then this is more a "also remind core contributor to include such a explanation" issue?

I do know that pandas is a really fast moving target and that's probably also because noone really cares about writing extensive commit or PR messages (or docs/comments for internal stuff... :-) ). But from the standpoint of a "not-core-dev", trying to understand commits/PRs later is a real pain :-(

re "commit logs clutter git log": I usually go via the github blame interface and there the commit log is the first thing which comes up but in pandas it's useless, I always have to go to the PR and even referenced issue and reread the whole discussion to (maybe) get an idea what's going on. So adding such a "problem description" at the top of the PR/issue, which explains teh motivation behind a change, would help a lot.

@janschulz I do symathize. However, adding more burden to the core devs is not the answer here. Sure, we can push back on the contributors to have a better description. Not entirely sure if the template actually helps with that though (not sure _anything_ helps).......

Unrelated to the PR itself, but if I may make excuses, the PR was clear from adjacent one and Travis failure. Though it's correct that we should make backgrounds clear as much as possible... :+1: 

I'm afraid describing "how" may look to be a little labor for contributors. Most of PRs can be understood from script and comments. otherwise we can request. 

> how does this change fix that problem

Not "how", but "why". "How" is clear from the code changes, but why is mostly not.

Basically it's doing more stuff now (=document the why it in the issue/PR) so that later you don't have to reread the discussion or make the research again. Or make it easier for newcomers...

OK, then something like this? pls ignore if it is enough clear for natives...

> Add description of the problem and **why** this change is needed (what is the problem, ~~how does this change fix that problem~~ and is the result after the change).

@TomAugspurger @jorisvandenbossche ?

I am leary of adding _more_ text in the PR's. maybe just add some more text in the `script/merge-pr` script as a reminder?

No strong opinion from me, mostly because I haven't often run into issues where the intent of a PR was unclear. 

I think this is covered by having people merging keep more of the text inside the PR.