[Twisted-Python] Black enabled in trunk

Glyph glyph at twistedmatrix.com
Wed Sep 16 12:09:19 MDT 2020


On September 15, 2020 at 11:04:45 PM, Tom Most (twm at freecog.net <mailto:twm at freecog.net>) wrote:
> On Tue, Sep 15, 2020, at 7:26 AM, Kyle Altendorf wrote:
> > On 2020-09-14 13:43, Glyph wrote:
> > 
> > >> On Sep 13, 2020, at 11:45 PM, Tom Most <twm at freecog.net <mailto:twm at freecog.net>> wrote:
> > >> To adjust the formatting:
> > >> 
> > >> tox -e black-reformat
> > >> 
> > >> The formatting is checked by a new GitHub Actions lint built.
> > > 
> > > Could we possibly use something like this:
> > > 
> > > https://github.com/cclauss/autoblack <https://github.com/cclauss/autoblack>
> > > 
> > > to just _do_ the formatting rather than "check" if it's correct? PR 
> > > templates are all well and good but the best checklist item is the one 
> > > that's already checked off...
> > 
> > It might be worthwhile but I think there is some downside to CI 
> > frequently injecting commits (or amending them).
> 
> I'm not opposed to it in principle, but is there a version of this that works? That link says "tl;dr: It does not work."

If you dig around you can see that there are various ways to make it work, including deploying the slash-command version rather than the on-push version.

> I don't want to develop custom tooling. This project is about moving away from that!

At least if we're building new tooling we could build it separately from Twisted so it could apply across different projects; at least different projects in the org, a the very least ;)

> > >> Inevitably, changes like this cause conflicts. For small PRs it's 
> > >> easiest to merge forward and then run tox -e black-reformat. For 
> > >> larger ones it can help to apply formatting before merge. To do this:
> > >> 
> > >> * Run black on the files your branch changes (be sure to use Black 
> > >> 20.8b1, not an older version)
> > >> * Commit the result, like `git commit -am "Fade to black"`
> > >> * Add that commit to .git-blame-ignore-revs to avoid polluting git 
> > >> blame.
> > 
> > Is .git-blame-ignore-revs going to be the next 'newsfile' what with 
> > every PR adding lines to it? Also, for the record, this doesn't address 
> > GitHub blame and does require everyone set the previously mentioned git 
> > config since it doesn't go with the repo. :[ Though that's mostly an 
> > annoyance with git.
> 
> I don't expect so. There aren't that many PRs large enough to benefit from this technique, and large PRs tend to enter the codebase slowly. 

I'm not usually a huge fan of rebasing, but presumably some history-rewriting could help avoid needing this?

> 
> > Oh yeah... thanks!
> 
> You're welcome! 
> 
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com <mailto:Twisted-Python at twistedmatrix.com>
> https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python <https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20200916/8f89f0ee/attachment.htm>


More information about the Twisted-Python mailing list