The python black project.
Sean Mooney
smooney at redhat.com
Thu Apr 18 21:11:59 UTC 2019
On Thu, 2019-04-18 at 16:42 -0400, David Peacock wrote:
> I had my concerns when I saw Python Black promoted in other quite some time
> ago, and the same concern strikes me now I revisited it.
>
> I strongly oppose Python Black adoption for this reason:
>
> https://black.readthedocs.io/en/stable/the_black_code_style.html#line-length
>
> 88 char line lengths is a table stakes deal breaker for me (and I suspect
> others), and since the black project relies on no exceptions or discussions
> about details, this makes it a non-starter.
>
> -1 for me.
so i have mentioned this in the thread before but you can change there default
if you drop a pyproject.toml file into the root of the repo black will read its defaults
from there
so we can set something like the following
[tool.black]
line-length = 79
target_version = ['py27']
skip-string-normalization = true
include = '\.pyi?$'
exclude = '''
(
/(
\.eggs # exclude a few common directories in the
| \.git # root of the project
| \.tox
| \.venv
| \docs
| \releasenotes
)/
)
'''
that will disable the "" to '' normalisation and it will keep the line-length at 79
yapf is more configurable but black allows you to set the 2 things that most people
take issue with. the line lenght and stings.
>
David.
On Thu, Apr 18, 2019 at 4:52 AM Natal Ngétal <natal at redhat.com> wrote:
Hi everyone,
Black is project to format Python code. It's more and more used by the
python
community. That can save time and harmonize the code. For example, simple
quote
versus double quote, that was not checked by pep8.i It's just an example of
what make black With a pre-hook commit hook this will be also avoid to
lose
time with pep8 errors.
Two links to see more:
https://github.com/ambv/black
https://www.mattlayman.com/blog/2018/python-code-black/
I think it can be very interesting to start to use Black on OpenStack. What
do you thinks about that? For example, we can introduce it on some
projects, I
would volunteer to try on TripleO.
My best regards
More information about the openstack-discuss
mailing list