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
Apply blackdoc to python source #4119
Conversation
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.
Excellent. I was always concerned that the docstring code was not formatted by black. This solves that!
Codecov Report
@@ Coverage Diff @@
## main #4119 +/- ##
=======================================
Coverage 95.56% 95.56%
=======================================
Files 95 95
Lines 20247 20247
=======================================
Hits 19350 19350
Misses 897 897 |
Any chance that we can separate the black run from any other change (i.e. adding this to pre-commit) into separate PRs? I'd like to be able to skip the style PR's merge commit in the git blame. As usual. |
To be clear the ideal situation would be to separate all autoformatting. If you changed anything manually and know what that was, that should also be moved along with the other changes (because we want to see all human actions in the blame). With one big commit that's probably not feasible though. And along with the pre-commit addition we should add a check for this in CI, otherwise noncomforming commits will startvseeping back quick. |
I guess the pre-commit error will stop CI, isn't it? pyvista/.github/workflows/style_docstr.yml Lines 16 to 26 in 5ff97bb
|
Aaah, right! Thanks @tkoyama010 👍 |
This would be a good example where a merge commit would be better to preserve the commit history in a PR (one commit for each step here), but we have disabled this (for good reasons). Another thought is that you could have two PRs, one for adding to our pre-commit (this will fail), the other for the changes. You would merge the first if the second passes and then merge them in one after the other. A lot of extra work however. |
That's what I had in mind. First merge the autoformatting changes, then adding the pre-commit hook and any hypothetical manual changes needed.
Only if @akaszynski touched formatting beyond running blackdoc. The non-autoformat changes would be quite obvious otherwise. And we can only do this right once, now, or we'll be stuck with crap history. It's of course possible that I'm the only one looking at git blames, in which case "sucks to be me" is another option :P |
Agree with separating this out. I didn't consider git blame, but when I do need it it's quite valuable for tracking down bugs. |
You could keep most of the changes here, and just revert the few other changes. Whichever is less of a hassle. |
Ok @adeak. I went ahead and opened #4120. I would like to merge the changes from branch into main with and also add After the merge I will add the commit hash to the See |
Please note that the changes here are entirely from the auto-formatter. Recommending merging this PR first and adding the ignore rev file to #4120. |
I'm on mobile for the next few hours still, but if this has autoformatting only then this is good to go. Any manual corrections would have to be put elsewhere anyway. Adding the ignore-revs item in the follow-up is fine too. For the original blackening we had #2684. Thanks a lot @akaszynski. |
This sounds like a good plan |
Also pointing out for posterity that the changes here were made with an explicit exclusion of |
I’ll work on the follow up PR and implement the changes before enforcing blackdox. Thanks for the comments, I’ll be less trigger happy… |
It's all good, I wouldn't have approved if I had insisted on taking a close look before merge :) In the worst case of changing the config and rerunning |
PyVista has adopted black, but we fail to implement this for our documentation or doc strings.
This PR implements blackdoc to reformat all Python code in our docstrings as a
pre-commit
.Pinging @jorgepiloto because this is really cool and IMO works better than blacken-docs