<div dir="ltr"><div>We have been using black code style for a while now together with pre-commit hooks[0] and it has been great.<br></div><div><br></div><div>There are some good reasons to adopt black - even in beta:</div><div> </div><div>1 - Standard - This makes life easier to anyone that wants to contribute to a certain project. <br></div><div>     Same standard across all code basis maintained by the pulp-team, it could make life easier for new contributors.<br></div><div></div><div>2 - Code Review - Focus on the logic, not in code styles. <br></div><div>...<br></div><div></div><div>          <br></div><div>For example, pytest[1] adopted black as well.<br></div><div></div><div><br></div><div>[0] <a href="https://github.com/pre-commit/pre-commit-hooks">https://github.com/pre-commit/pre-commit-hooks</a></div><div>[1] <a href="https://docs.pytest.org/en/latest/contributing.html">https://docs.pytest.org/en/latest/contributing.html</a></div><div>   <br></div><div><br></div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 4, 2019 at 8:45 AM Dana Walker <<a href="mailto:dawalker@redhat.com" target="_blank">dawalker@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>--Dana<br></div><div><br></div><div><div><div dir="ltr" class="m_-7437776140645474212gmail-m_4788919535020944826gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div>
        <p style="font-weight:bold;margin:0px;padding:0px;font-size:14px;text-transform:capitalize;font-family:"RedHatText",sans-serif">
          <span>Dana</span> <span>Walker</span><span style="color:rgb(170,170,170);margin:0px"></span>
        </p>
        <p style="font-weight:normal;font-size:12px;margin:0px 0px 4px;text-transform:capitalize;font-family:"RedHatText",sans-serif">She / Her / Hers</p>
        <p style="font-weight:normal;font-size:12px;margin:0px;text-transform:capitalize;font-family:"RedHatText",sans-serif">
          <span>Software Engineer, Pulp Project</span>
        </p>
        <p style="font-weight:normal;margin:0px 0px 4px;font-size:12px;font-family:"RedHatText",sans-serif">
          <a style="color:rgb(0,136,206);font-size:12px;margin:0px;text-decoration:none;font-family:"RedHatText",sans-serif" href="https://www.redhat.com" target="_blank">Red Hat <span></span></a>
        </p>
    <div style="margin-bottom:4px">
      
      
    </div>
    <p style="font-weight:normal;margin:0px;font-size:12px;font-family:"RedHatText",sans-serif">
      <span style="margin:0px;padding:0px"><a style="color:rgb(0,0,0);font-size:12px;margin:0px;text-decoration:none;font-family:"RedHatText",sans-serif" href="mailto:dawalker@redhat.com" target="_blank">dawalker@redhat.com</a>   </span>
      
      
    </p>
    
    

    <div style="margin-top:12px">
      <table border="0">
        <tbody><tr>
          <td width="100px"><a href="https://www.redhat.com" target="_blank"> <img src="https://marketing-outfit-prod-images.s3-us-west-2.amazonaws.com/f5445ae0c9ddafd5b2f1836854d7416a/Logo-RedHat-Email.png" width="90" height="auto"></a> </td>
          
        </tr>
      </tbody></table>
    </div>

  </div><table border="0"><tbody><tr><td width="100px"><br></td>
</tr></tbody></table>

</div></div></div></div></div></div></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 4, 2019 at 8:27 AM David Davis <<a href="mailto:daviddavis@redhat.com" target="_blank">daviddavis@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">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.<div><br></div><div>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].</div><div><br></div><div>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. </div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div><div>[0] <a href="https://github.com/python/black" target="_blank">https://github.com/python/black</a></div><div>[1] <a href="https://en.wikipedia.org/wiki/There%27s_more_than_one_way_to_do_it" target="_blank">https://en.wikipedia.org/wiki/There%27s_more_than_one_way_to_do_it</a></div><div>[2] <a href="https://www.python.org/dev/peps/pep-0020/#id3" target="_blank">https://www.python.org/dev/peps/pep-0020/#id3</a></div><div>[3] <a href="https://github.com/python/black#editor-integration" target="_blank">https://github.com/python/black#editor-integration</a></div><div>[4] <a href="https://github.com/python/black#version-control-integration" target="_blank">https://github.com/python/black#version-control-integration</a><br clear="all"><div><div dir="ltr" class="m_-7437776140645474212gmail-m_4788919535020944826gmail-m_-5069226031411056179gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>[5] <a href="https://github.com/django/deps/blob/master/accepted/0008-black.rst" target="_blank">https://github.com/django/deps/blob/master/accepted/0008-black.rst</a></div><div>[6] <a href="https://github.com/pulp/pulp_rpm/pull/1355" target="_blank">https://github.com/pulp/pulp_rpm/pull/1355</a></div><div>[7] <a href="https://github.com/pulp/pulp_python/pull/177" target="_blank">https://github.com/pulp/pulp_python/pull/177</a></div><div><br></div><div>David<br></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
Pulp-dev mailing list<br>
<a href="mailto:Pulp-dev@redhat.com" target="_blank">Pulp-dev@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/pulp-dev" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/pulp-dev</a><br>
</blockquote></div>
_______________________________________________<br>
Pulp-dev mailing list<br>
<a href="mailto:Pulp-dev@redhat.com" target="_blank">Pulp-dev@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/pulp-dev" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/pulp-dev</a><br>
</blockquote></div></div>