Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Auto-format Python code #14449

@rth

Description

@rth

As mentioned by @sbc100 in #7181 (comment)

We could also encourage the use of yapf which actually makes all the formatting decisions for you: https://github.com/google/yapf. Similar to clang-format.

To be complete, another popular tool now is https://github.com/psf/black though it won't work with 2 space indentation.

This might make different Python scripts / modules a bit more readable and easier to contribute to, in particular when used in combination with pre-commit.

Though it might make using git blame [1] and conflict resolution in PRs [2] slightly harder.

[1] https://black.readthedocs.io/en/stable/guides/introducing_black_to_your_project.html#avoiding-ruining-git-blame
[2] scikit-learn/scikit-learn#20260 (comment)

(links are for black, but I imagine with yapf it would be a similar situation)

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