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.

ci: Introduce code formatter

See original GitHub issue

🚀 Feature

We’ve spent quite some time on fixing code formatting in code reviews by our own hands, but this should be done automatically by a Python code formatter.

List of formatters

Additional context

I have used black with isort (for import formatting) and flake8 (for pep8 check) in Optuna, and it worked really well, so +1 for black.

In PL, black was added in https://github.com/PyTorchLightning/pytorch-lightning/pull/1610, but it hasn’t been really used… We can start to employ the code formatter here, and if there seems no problem with it, we can enable it in PL later, too.

cc: @Borda @PyTorchLightning/bolts-contributors

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
akihironittacommented, Dec 28, 2020

@oke-aditya @briankosw Thank you both for sharing the useful information! So, as I read your comments, I believe we should do the followings.

To do

  1. add black to pre-commit hooks
  2. add black to GitHub Actions
  3. update flake8 and isort configs to avoid conflicts with black
  4. add the badge to readme

Let’s get to work on this once we have positive comments from other core members :]

1reaction
Bordacommented, Jan 9, 2021

we can easily check formatting including trailing-whitespaces

I think that we can do this check with flake8 right? but yes, lest try black here :]

UPDATE: well just check the listed yapf and it looks better, seems to be more flexible and particular I like COALESCE_BRACKETS see: https://www.kevinpeters.net/auto-formatters-for-python

Read more comments on GitHub >

github_iconTop Results From Across the Web

ci: Introduce code formatter · Issue #482 - GitHub
I have used black with isort (for import formatting) and flake8 (for pep8 check) in Optuna, and it worked really well, so +1...
Read more >
How To Enforce Formatting in Continuous Integration - Medium
This story will cover Java code formatter in IntelliJ and Format check in Continuous Integration pipeline. I picked Java cause there is a ......
Read more >
CI: code formatting check added - Developers - Suricata
Hi all, Just a heads up that we now ship a .clang-format file, ... Introducing improperly formatted code is now a reason for...
Read more >
Consistent Python code with Black - Matt Layman
This post focuses on Black, a code formatter, how it can improve your project's code style, and how you or your team can...
Read more >
Creating a Formatter Extension - Visual Studio Code
Since its introduction, the Visual Studio Code extension API has provided support for source code formatters. The first language extensions ...
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