question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adopt black for code formatting

See original GitHub issue

In pandas we recently started using black (https://github.com/psf/black) for automatic code formatting. I don’t like all the style choices that it makes, but I do like that fact that you don’t have to worry any more about code style yourself when writing, or need to comment (or argue) on PRs about code style.

So what are your thoughts on using it for geopandas as well?

If we do it, I think we should add a CI check to enforce it (and add a pre-commit hook that people can use, which will run black when committing). Which does mean that this can make it a bit harder to do a PR as a pass-by contributor (as you might get failures for style).

Anyway, we also did not yet check for PEP8 (flake8) on CI currently, which is something which we should start doing otherwise I think. But since that also introduces possible failing CI due to style, I would personally directly go for black.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
ljwolfcommented, Aug 29, 2019

I’m in favor. I dig black.

I also think if folks don’t know how to run the formatter on their contribution, a maintainer can always run it before merging. That’s kind of @jdmcbr’s suggestion, but it ensures the formatting happens at the point of the contribution.

0reactions
jorisvandenbosschecommented, Sep 12, 2019

OK, so black and flake8 are enabled on travis now. Let’s see how it goes for a while, we can always revisit that if it turns out a hurdle or annoyance on PRs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Black code style - Black 22.12.0 documentation
Black ignores previous formatting and applies uniform horizontal and vertical whitespace to your code. The rules for horizontal whitespace can be summarized as: ......
Read more >
Write clean Python code with Black
Black is a code formatter that automatically adjusts your Python code after a well-defined rule set. In this article, I discuss the need...
Read more >
Adopt Black for formatting Python code · Issue #3806 - GitHub
Black is being adopted by Django and other projects as the default formatter, and it makes sense for us to adopt it too....
Read more >
Consistent Python code with Black - Matt Layman
This post focuses on Black, a code formatter, how it can improve your ... What happens when a project adopts a tool that...
Read more >
Adopting Black - Home Assistant Developer Docs
Today we have officially adopted the Python code formatting tool Black. All code has been formatted with Black and all future contributions ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found