-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: Introduce code formatter #482
Comments
I have used black earlier and we can add a simple CI check for it as well. Also we can add to |
They can definitely work together, and black themselves published suggestions on how to make I think using |
@oke-aditya @briankosw Thank you both for sharing the useful information! To do
Let's get to work on this once we have positive comments from other core members :] |
@Borda @PyTorchLightning/bolts-contributors Shall we introduce |
I think that we can do this check with UPDATE: well just check the listed |
@Borda I've just noticed your updated comment (though I already created a draft PR #507 to add black). I agree that @oke-aditya @briankosw Please leave your comments if you've got any. |
Personally I would prefer flexibility over mainstream... I would not be affraid of using yapf since it Facebook in house tool... |
I have used black. I do not like it much. it makes code too lengthy and is very strict checker, also collides with isort and flake8. I'm not sure how to configure yapf, how to add CI, pre commit though. I agree with @Borda's suggestion. I would like a flexible formatted (like flake8). Also facebook style would be preferred. But we need consistency with PyTorchLightning too, it might also need to use yapf. Torchvision uses only flake8 though. |
black
for the record, this is the proposed config
|
🚀 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
black
by Python Software Foundation (https://github.com/psf/black)black
is the most popular one.yapf
by Google (https://github.com/google/yapf)autopep8
, ...)Additional context
I have used
black
withisort
(for import formatting) andflake8
(for pep8 check) in Optuna, and it worked really well, so +1 forblack
.In PL,
black
was added in Lightning-AI/pytorch-lightning#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
The text was updated successfully, but these errors were encountered: