Fix black by eggplants · Pull Request #1763 · RDFLib/rdflib (original) (raw)

its outputs were different between versions which caused Git diffs as people used different versions over time

Thats right. Eg, if I had v21.2b0 installed in my development environment, ran black before my PR, my PR got merged. But you have black v21.4b0 on your system, now when you run black some of my formatted code gets changed again, causing diff noise in almost every pull request.
Then when we introduced black checking on the CI test pipeline, it used v21.6b0, and now PRs are flagged as non-conformant to Black, even if you formatted it with your version before pushing.
So we decided to settle on "this is the one black version we use for RDFLib", we put that in the documentation, and pinned that in the requirements.
In v21.6b0 black even introduced the --required-version option when running black, so that your check would fail if you were not using the exact given version of the tool, that is to prevent the issues we've seen. We use that in our CI test.

I think we can pin to black per major or semi-major release of RDFLib so we can update black over time, just not with every PR!

Now Black is out of the recent January release, black v22.1.0 is finally out of Beta. So that means we should definitely update to using that as "the black version we use for RDFLib". However I'm not sure about unpinning it, and I still think we should have --required-version set to match, eg 22.1.0.