https://pantsbuild.org/ logo
#general
Title
# general
h

high-yak-85899

03/29/2022, 11:00 PM
Anyone have settings they've liked for
update-build-files
formatting? I'm using yapf, but I'm not really crazy about what the defaults do. Here's a good example
Copy code
python_sources(
    overrides={"cloud_storage.py": {
        "dependencies": ["//:reqs#boto3"]
    }})
h

hundreds-father-404

03/29/2022, 11:00 PM
I'm v-pro Black, but @fresh-cat-90827 might have Yapf opinions as the contributor for that feature
h

high-yak-85899

03/29/2022, 11:01 PM
my only rationale for using yapf is that's what we format our py modules with already 🤷
👍 1
If I ever get time to explore pants source code, I'd love to not have to write this out
Copy code
[yapf]
version = "yapf==0.20.0"
h

hundreds-father-404

03/29/2022, 11:14 PM
how come you have to write that out rather than the default?
h

high-yak-85899

03/29/2022, 11:14 PM
I initially had
Copy code
[yapf]
version = "0.20.0"
and that led to a confusing error saying it couldn't resolve a known version
I'm trying to figure out why
update-build-files
runs differently than when I run
yapf
on a
BUILD
file manually
👀 1
h

hundreds-father-404

03/29/2022, 11:15 PM
Ah. So we used to actually use "0.20.0", but we changed it so that you can do things like VCS requirements & forks of tools 🙂
Maybeeeee we could add an affordance so that "0.20.0" defaults to
yapf==0.20.0
? I'm not sure if that's too magical? Seems reasonable to me!
You could use
-ldebug
to see the argv Pants is using
h

high-yak-85899

03/29/2022, 11:18 PM
looks like the versioning was causing the difference.
0.32.0
behaves differently.
👍 1
h

hundreds-father-404

03/29/2022, 11:23 PM
what do you think about https://pantsbuild.slack.com/archives/C046T6T9U/p1648595750306249?thread_ts=1648594815.824819&cid=C046T6T9U? If that can remove a common gotcha, I'm generally +1. We really want to keep removing friction like that
h

high-yak-85899

03/29/2022, 11:24 PM
I think I just misunderstood the flexibility of
version
from the docs
👍 1
5 Views