Skip to content

STY: Wrap __all__ to one entry on each line, and add trailing commas #9453

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

Closed
wants to merge 1 commit into from

Conversation

eric-wieser
Copy link
Member

@eric-wieser eric-wieser commented Jul 24, 2017

Having this line-wrapped by column causes needless merge conflicts.

Done by repeated application of s/(__all__ = \[(?:\n '\w+',)+) ('\w+')/\1\n \2/g

Pros:

  • Merging should work automatically for two newly added functions
  • Alphabetic sorting is easier, if we still care about that (we seemingly started off doing that)
  • git blame becomes useful for seeing when things were added to from numpy import *

Cons:

  • 700 more lines
  • Causes merge conflicts for existing feature PRs

Would be reasonably straightforward to sort these too, if desirable

Having this line-wrapped by column causes needless merge conflicts.

Done by repeated application of s/(__all__ = \[(?:\n    '\w+',)+) ('\w+')/\1\n    \2/g
@charris
Copy link
Member

charris commented Jul 24, 2017

I'd sort them and collapse them again. I think merge problems due to __all__ are not common and when they occur are easily dealt with.

@eric-wieser
Copy link
Member Author

eric-wieser commented Jul 24, 2017

I'd sort them and collapse them again.

This isn't helpful, because then people just add new functions in a random place, because they don't want to rewrap all the lines. The only use in sorting it would be if we intend to always keep it sorted.

when they occur are easily dealt with.

This is fine for recent PRs, but for old ones where the author no longer cares, this requires one of us to checkout and rebase the branch, which is a lot harder than just hitting the merge button.

I suppose this is already a problem with targeting the wrong release notes, but that too can be fixed by using the matplotlib approach of creating separate rst files per feature, and merging them upon release

@charris
Copy link
Member

charris commented Jul 24, 2017

Being less diplomatic, the single entry per line is unusual and, IMHO, really ugly ;)

Release notes are a problem worth looking into, although I'm not convinced that the matplotlib example is the way to go. It would be nice to automate it more, maybe by adding a release notes section to the PR. Not sure that we can do that though. Maybe there are some hooks. Or it could be added to the PR description with a template and then parsed when the merged PR's are put together for the changelog. That wouldn't cover all sections but might take care of the busiest ones.

'ascontiguousarray', 'asfortranarray', 'isfortran', 'empty_like',
'zeros_like', 'ones_like', 'correlate', 'convolve', 'inner', 'dot',
'outer', 'vdot', 'roll',
'rollaxis', 'moveaxis', 'cross', 'tensordot', 'array2string',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would argue that randomly wrapped things like this are more ugly

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Easy enough to fix up now and then. But I think this PR solves a mostly non-problem.

@seberg
Copy link
Member

seberg commented Jul 25, 2017

I think I have to agree with Chuck. Don't see much of a problem here and the massive lines of code are also annoying/not pretty in my eyes. I am happy about resorting them alphabetically, but it can also stay as fly by maintenance as now.

I am pretty sure it would be relatively easy to add a test/style check to Travis to check for __all__ actually being alphabetic if we actually care enough (maybe there are other similar things one could check too then, dunno).

@njsmith
Copy link
Member

njsmith commented Jul 25, 2017

I am indifferent to how __all__ is formatted, but regarding release notes, I'd suggest looking at towncrier.

The basic idea is that each PR includes a little file containing its news entry dropped into a special directory, so they can be reviewed along with the patch, carried along with backports, etc., and then at release time you run a command to automatically bundle these up into the documentation.

@charris
Copy link
Member

charris commented Jul 29, 2017

@eric-wieser I'm going to close this unless you want to argue about it some more ;)

@eric-wieser
Copy link
Member Author

I wouldn't say it's a non-problem, but it is a minor one - and it sounds like other contributors consider the line noise a larger one. Unless anyone else feels the same way as me, closing this sounds like the right approach

@charris charris closed this Jul 31, 2017
@charris
Copy link
Member

charris commented Jul 31, 2017

OK, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants