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