-
Notifications
You must be signed in to change notification settings - Fork 560
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
Force a specific version of black
in format checking
#2839
Comments
@nicholascar @edmondchuc |
Sounds fine to me. I'm also curious whether black is still needed since we are also using ruff for linting, because ruff also includes a more performant drop-in replacement formatter for black. I haven't had the need for black for a while now as I just rely on linting, import sorting as well as formatting all on ruff. |
Yeah, I had the same thought. The formatting provided by ruff and black are definitely different, but I don't know if one is better than the other. Ruff is a great all-in-one tool. |
Ok cool, let's go with your plan and we can always revisit in the future whether we should drop black in favour of ruff format when we have time to investigate. |
Fixed by #2843 |
Black is a tool for ensuring consistent python formatting from all contributors across the whole codebase.
Black was in beta for a long time, but in Jan 2023 it released its first "stable" version, where the code formatting generated by Black is considered "stable" and not subject to change.
However it is observed that people using different versions of "black" will produce different code than others, and if the CI tool is using a different version than a contributor is using, it can emit formatting errors and block the PR merge.
It is for this reason that black introduced the "required-version" config option. This way you can enforce only a specific version of black to be used, the tool will throw an error if a different version is being used.
This reflects the "lets pick one version of Black to use, and stick with it, and tell everyone to use that one" decision the RDFLib maintainers made back in April 2020.
The introduction of dependabot has bumped the version of "black" once or twice a month for the last two years. Black is the most commonly updated dependabot package, but there is no point updating it (outside of security fixes) and it makes it difficult for users to know which is the correct version to use.
I propose to merge just the latest version of "black" (v24.4.2), add "black" to the dependabot ignore list, and add the "required-version=24.4.2" to black config so we always use that version.
The text was updated successfully, but these errors were encountered: