Skip to content

Force a specific version of black in format checking #2839

Closed
@ashleysommer

Description

@ashleysommer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions