Skip to content

DEV: reduce merge conflicts by sorting whatsnew notes by issue number? #51715

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

Merged
merged 8 commits into from
Mar 2, 2023

Conversation

MarcoGorelli
Copy link
Member

@MarcoGorelli MarcoGorelli commented Mar 1, 2023

The script which does this is scripts/sort_whatsnew_note.py. There's a defensive check inside to validate that it has only reordered the lines of a file, and hasn't changed anything else


Rather than tagging all of core/triage, I've just request a review from whoever participated in #50275 - but if this proves controversial we can tag the rest

@jbrockmendel
Copy link
Member

Implementation seems fine, im going to post general thoughts in #51712

@bashtage
Copy link
Contributor

bashtage commented Mar 1, 2023

Agree implementation looks fine, would be good to see if could be automated as part of the test suite. Could you add that so one could check the before and after whatsnew file for differences?

@MarcoGorelli
Copy link
Member Author

yup, done - have run it over all files, you can check what it changes

@bashtage
Copy link
Contributor

bashtage commented Mar 1, 2023

This feels like a real win to me for reducing whatsnew conflicts.

Copy link
Contributor

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

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

I like this idea, but I wonder if we should just do this for whatsnew notes starting with 2.0 and not change the ordering for old whatsnew notes

Also, going forward, if someone does a PR and updates the whatsnew of the latest version, is there something we can do to automate the sorting as part of either pre-commit or CI?

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

Nice idea

@MarcoGorelli
Copy link
Member Author

Thanks!

Also, going forward, if someone does a PR and updates the whatsnew of the latest version, is there something we can do to automate the sorting as part of either pre-commit or CI?

Yup, it's in pre-commit

@bashtage
Copy link
Contributor

bashtage commented Mar 2, 2023

One more - does this run in CI and will CI fail if this returns non-zero?

@MarcoGorelli
Copy link
Member Author

MarcoGorelli commented Mar 2, 2023

That's right! You can see it here: https://github.com/pandas-dev/pandas/actions/runs/4312190011/jobs/7522443368

 sort whatsnew entries by issue number...................................................................Passed
- hook id: sort-whatsnew-items
- duration: 0.05s

And yes, it'll return non-zero exit code if it would've modified any file (like all pre-commit hooks)

Copy link
Contributor

@bashtage bashtage left a comment

Choose a reason for hiding this comment

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

LGTM and a no regret way to reduce merge conflicts.

Copy link
Contributor

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

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

LGTM

@MarcoGorelli
Copy link
Member Author

I've amended this to exclude 2.0.0, so it'll only be applied going forwards

If in 3.0.0 we want to keep some parts of a section grouped, we can just make subsections, e.g.

Removal of prior version deprecations/changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Non-keyword arguments
^^^^^^^^^^^^^^^^^^^^^
- Disallow passing non-keyword arguments to :func:`read_excel` except ``io`` and ``sheet_name`` (:issue:`34418`)
- Disallow passing non-keyword arguments to :meth:`DataFrame.drop` and :meth:`Series.drop` except ``labels`` (:issue:`41486`)

Behavior changes
^^^^^^^^^^^^^^^^
- Changed behavior of :meth:`Series.quantile` and :meth:`DataFrame.quantile` with :class:`SparseDtype` to retain sparse dtype (:issue:`49583`)

@WillAyd WillAyd merged commit e1a42f3 into pandas-dev:main Mar 2, 2023
@WillAyd
Copy link
Member

WillAyd commented Mar 2, 2023

Thanks @MarcoGorelli

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

Successfully merging this pull request may close these issues.

DEV: reduce merge conflicts by sorting whatsnew notes by issue number?
6 participants