Blue -- Some folks like black but I prefer blue.
Project description
Some folks like black but I prefer blue.
What is blue?
blue is a somewhat less uncompromising code formatter than black, the OG of Python formatters. We love the idea of automatically formatting Python code, for the same reasons that inspired black, however we take issue with some of the decisions black makes. Kudos to black for pioneering code formatting for Python, and for its excellent implementation.
Where the blue maintainers disagree with the stylistic (and unconfigurable) choices made by black, we monkeypatch to change these decisions to our own liking. We intend for these differences to be minimal; even in cases where we’d prefer something different, there’s a lot we can live with for the sake of consistency.
We’d prefer not to fork or monkeypatch. Instead, our hope is that eventually we’ll be able to work with the black maintainers to add just a little bit of configuration and merge back into the black project. We’d be ecstatic if blue eventually were retired. Until then, we’ll maintain our small set of hacks on top of black and carefully consider what other deviations are needed to assuage our sensitive, but experienced, eye.
How do I use blue?
Exactly the same as you would use black. Invoke and configure blue as you would black – just replace the black command with blue, sit back, and enjoy even betterly formatted Python code! You can refer to black’s documentation for anything not listed here.
Try it out now using iblueit.dev.
So what’s different?
Here is a brief list of differences between blue and black:
blue defaults to single-quoted strings. This is probably the most painful black choice to our eyes, and the thing that inspired blue. We strongly prefer using single quoted strings over double quoted strings for everything except docstrings and triple quoted strings (TQS). Don’t ask us why we prefer double-quotes for TQS; it just looks better to us! For all other strings, blue defaults to single quoted strings. In the case of docstrings, those always use TQS with double-quotes.
blue defaults to line lengths of 79 characters. Nearly every project creates a pyproject.toml just to change this one setting so making it consistent with PEP 8 seems relatively harmless.
blue preserves the whitespace before the hash mark for right hanging comments.
blue supports multiple config files: pyproject.toml, setup.cfg, tox.ini, and .blue.
We are accumulating a list of other deviations we are considering. As we decide to implement any particular suggestion, we’ll turn those into individual issues and tackle them one-by-one. If you have suggestions for other deviations from black’s choices, please open a separate ticket on our tracker, and we’ll see how it goes!
Why “blue”?
Several reasons! If your formatter is going to beat up your code, it’ll leave it black and blue, or maybe in this case, black or blue. Blue is better!
We also thought about “tan” because, yum! But that project name was already taken. Frankly, “blue” was also taken, but largely unused. Our thanks to Nick Ficano for donating the project namespace to us!
Blue is also the color of LinkedIn, the authors’ gracious employer, and we intend to socialize its use within our company code base.
Contributors
blue thanks this list of contributors for all its wonderful goodness.
The wonderful folks from the black project.
Grant Jenks
Barry Warsaw
Corey from FutureSpaceDesigns for the unofficial logo and blue project merchandise.
blue is licensed under the terms of the Apache License Version 2.0. black is licensed under the terms of the MIT license.
Project details
Project home: https://github.com/grantjenks/blue
Report bugs and suggestions at: https://github.com/grantjenks/blue/issues
Code hosting: https://github.com/grantjenks/blue.git
Documentation: https://blue.readthedocs.io/en/latest
Try it out: https://iblueit.dev
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file blue-0.9.1.tar.gz
.
File metadata
- Download URL: blue-0.9.1.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76b4f26884a8425042356601d80773db6e0e14bebaa7a59d7c54bf8cef2e2af5 |
|
MD5 | b36a961280d8ba46ab83103b8ef9b1af |
|
BLAKE2b-256 | 685aef15e7accbe49dbeeb8e7c01e13b8459006c6fed4db8fe833f2ae4924fd7 |
File details
Details for the file blue-0.9.1-py3-none-any.whl
.
File metadata
- Download URL: blue-0.9.1-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 037742c072c58a2ff024f59fb9164257b907f97f8f862008db3b013d1f27cc22 |
|
MD5 | 6859e8e3ad9f0145264621cb1b47d6e4 |
|
BLAKE2b-256 | c57be6bfbe69b8b22abbfbdd993142bcabd1b2ce237a42c250181c5152052feb |