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

Migrate codebase to an autoformater? #281

Closed
jasonkuhrt opened this issue Oct 20, 2018 · 11 comments
Closed

Migrate codebase to an autoformater? #281

jasonkuhrt opened this issue Oct 20, 2018 · 11 comments

Comments

@jasonkuhrt
Copy link

jasonkuhrt commented Oct 20, 2018

I cloned the codebase tonight to work on a few issues. Was wondering if @samuelcolvin you'd be open to using an autoformatter (yapf, black, ...) to manage the project's style, to make collaborating easier?

fwiw I have experience setting yapf and black up including integrating into CI.

@samuelcolvin
Copy link
Member

I'll try them and give you an answer.

I'm afraid probably the answer is "no", I'm too used to reading code that looks like this.

@jasonkuhrt
Copy link
Author

Sure!

@Gr1N
Copy link
Contributor

Gr1N commented Oct 21, 2018

black one love :)

@jasonkuhrt
Copy link
Author

jasonkuhrt commented Oct 21, 2018

@Gr1N how do you feel about the long multi-item lines it enforces?

@Gr1N
Copy link
Contributor

Gr1N commented Oct 22, 2018

@jasonkuhrt I feel nothing. When I started use black I had many complaints and WTFs, but now, thanks balck, code for me just a code which I (and my colleagues) can write in one style.

@samuelcolvin
Copy link
Member

Ok, I've just done some playing (and wasted 30 minutes of my life reading psf/black#118).

I'd be happy to switch to black provided we use -S -l 120 (I'm not sure I'm ready yet to switch to double quotes), hopefully some day there will be a companion to black that enforces single quotes.

This will have another advantage that we can get away from flake8, pycodestyle and all that mess.

@Gr1N
Copy link
Contributor

Gr1N commented Oct 28, 2018

We can't get away from flake8, because black is only about code formatting and flake8 still can help you to show unused imports, vars or even possible bugs.

@samuelcolvin
Copy link
Member

boring, but ok

@MartinThoma
Copy link

I'm confused by this. Does pydantic use black now? Because when I run black, I see 173 file changes.

@MartinThoma
Copy link

If black is used, you might want to consider to state this in the README with a badge:

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

@samuelcolvin
Copy link
Member

Yes black is used, see the Makefile for configuration options.

No need for a badge for this, or isort or flake8 or mypy.

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

No branches or pull requests

4 participants