[Pulp-dev] black

David Davis daviddavis at redhat.com
Tue Jun 4 13:29:13 UTC 2019

On Tue, Jun 4, 2019 at 8:45 AM Dana Walker <dawalker at redhat.com> wrote:

> I think it's important to note that Django voted to adopt it once it is
> out of beta and stable, which is not yet the case.

This is true although it seems that they are close to being stable.
Although they were supposed to go stable right after PyCon:


> I was surprised they went for it instead of autopep8 or other options
> given the reason the pulp_python team closed the PR for black was that it
> was not pep8 compliant.  Maybe black has since improved in that area, but
> it's another downside to keep in mind and discuss/look into.

Black's documentation says that it's "a strict subset of PEP 8". The
conflict that arose in pulp_python is due to how black and flake8 handle
spaces around colons when one argument is omitted. It seems that there is a
bug in flake8 and there is an open issue:


> Given that there would still be the need for checking flake8 and pep8 in
> addition and it only adds yet another requirement and does not eliminate
> the need for other tools, I'm slightly opposed, but certainly open to any
> auto formatter if folks feel the consistency and lack of worry on context
> switching is worth it.

We could probably remove some of these tools/checks. It doesn't do certain
things like docstrings but it looks like we can run parts of flake8 like
pydocstyle without flake8. I think this is worth exploring more if we're
interested in black.

> --Dana
> Dana Walker
> She / Her / Hers
> Software Engineer, Pulp Project
> Red Hat <https://www.redhat.com>
> dawalker at redhat.com
> <https://www.redhat.com>
> On Tue, Jun 4, 2019 at 8:27 AM David Davis <daviddavis at redhat.com> wrote:
>> I wanted to get feedback from the Pulp community on using black[0] to
>> auto-format our Pulp 3 code. I have some mixed feelings about it as I see
>> some potential benefits of using it but also some downsides as well.
>> For potential upsides, I think it would be nice if all our projects in
>> Pulp conformed to the same style. It would make switching between projects
>> much easier. I've worked on other projects where each repository had its
>> own code style and it added a mental tax switching from one project to
>> another. Granted, this was in Ruby whose design incorporates the TMTOWTDI
>> philosophy[1] while Python's design is based around the principle "there
>> should be one way to do it"[2].
>> Moreover, using black would effectively take style comments/noise out of
>> PR reviews and we could just focus on logic. It integrates with a lot of
>> IDEs[3] and you can also set up a git pre-commit hook[4] so it would also I
>> think free developers from having to worry about formatting their code
>> while developing.
>> The main downside to black I see is that not everyone is going to love
>> it. It's highly opinionated and even personally, I don't like all the
>> stylistic decisions they've made. I guess it's a question if we can all
>> live with it or not. I feel much more confident in it since other projects
>> like django[5] have adopted it as well as Pulp QE.
>> There's a PR open currently against pulp_rpm[6] and one that was closed
>> against pulp_python[7]. I think if enough people are interested in using
>> black, we would update pulpcore, the plugin template, and possibly
>> pulp_file to use black. We could also recommend it to plugins but of course
>> we wouldn't/couldn't enforce its use.
>> [0] https://github.com/python/black
>> [1] https://en.wikipedia.org/wiki/There%27s_more_than_one_way_to_do_it
>> [2] https://www.python.org/dev/peps/pep-0020/#id3
>> [3] https://github.com/python/black#editor-integration
>> [4] https://github.com/python/black#version-control-integration
>> [5] https://github.com/django/deps/blob/master/accepted/0008-black.rst
>> [6] https://github.com/pulp/pulp_rpm/pull/1355
>> [7] https://github.com/pulp/pulp_python/pull/177
>> David
>> _______________________________________________
>> Pulp-dev mailing list
>> Pulp-dev at redhat.com
>> https://www.redhat.com/mailman/listinfo/pulp-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/pulp-dev/attachments/20190604/052796fc/attachment.htm>

More information about the Pulp-dev mailing list