I have an interesting `fmt` conflict between black...
# general
c
I have an interesting
fmt
conflict between black and isort. 🧵
They can’t agree on how to format my imports.. Black wants to format it like
Copy code
+from graphene import (
+    UUID,
+    DateTime,
+    Enum,
+    Field,
+    InputObjectType,
+    Int,
+    Interface,
+    List,
+    ObjectType,
+    PageInfo,
+    Scalar,
+    String,
+    Union,
+    relay,
+)
while
isort
wants to format it like this
Copy code
-from graphene import (UUID, DateTime, Enum, Field, InputObjectType, Int,
-                      Interface, List, ObjectType, PageInfo, Scalar, String,
-                      Union, relay)
So
./pants lint
never pass as they don’t agree on the formatting here.. what am I missing (configuration?). I don’t think I have any particular config in place for either of these tools.
w
i have seen flake8 and black fight over something too… ended up adding an ignore for one of them
oh. but also: i believe that you can configure isort to be black aware…?
🎯 2
👆 2
c
Ah, there it was, I looked in the pants repo, but missed the pyproject file…
That’s a gotcha perhaps worth mentioning in the docs, how to use black and isort in tandem..
👍 1
Thanks Stu, that was spot on.
👍 1
w
yea, doc updates welcome. pants proper strives for minimal configuration, but tool-specific config is a bit of a grey area… we could maybe add a warning if it’s not configured or something?
c
I think docs will be good enough
@witty-crayon-22786 https://www.pantsbuild.org/v2.8/docs/python-linters-and-formatters#black-and-isort-can-work-together There is no way to save draft changes, besides the “public” suggest edits form, right?
w
… i think that’s correct, yea.
c
so with that, I wanted to say, that I added a section for “black and isort” config, that you might want to review 😉
w
thank you!
looks great.
👍 1