youtube / spitfire

A high-performance Python template language
BSD 3-Clause "New" or "Revised" License
404 stars 58 forks source link

Choose an auto-format Python style #20

Closed nicksay closed 8 years ago

nicksay commented 8 years ago

I think we should use https://github.com/google/yapf to auto-format our Python code.

I think there are 2 styles we should consider:

  1. pep8 (see CreatePEP8Style)
  2. google (see CreateGoogleStyle)

Sample change that chooses pep8 style: https://github.com/nicksay/spitfire/compare/yapf-pep8

Sample change that chooses google style: https://github.com/nicksay/spitfire/compare/yapf-google

Since it's hard to see the difference between the styles in those changes, look at https://github.com/nicksay/spitfire/commit/0031ea1744cbf9a15b860a017579c1c93a760a35 instead. This change first formatted with pep8 style, then as google style; so, what's shown is the diff in moving from pep8 to google style.

nicksay commented 8 years ago

@awbraunstein Let me know what you think

awbraunstein commented 8 years ago

Yes!!! No more 2 space indentation!!!

I personally like the google style over PEP8. There is a little more whitespace which I personally like. What do you think?

nicksay commented 8 years ago

I also prefer the Google style; the differences are minimal and I prefer the small changes (e.g. 80-char vs 79-char line limit and closing bracket style).

Done.