Skip to content
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

Auto-format Python code #14449

Open
rth opened this issue Jun 14, 2021 · 1 comment · May be fixed by #23154
Open

Auto-format Python code #14449

rth opened this issue Jun 14, 2021 · 1 comment · May be fixed by #23154

Comments

@rth
Copy link
Contributor

rth commented Jun 14, 2021

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants