Hopefully a quick "quality of life" question but c...
# general
p
Hopefully a quick "quality of life" question but can anyone explain to me how to get
./pants fmt ::
with
black
to run on my BUILD files? I've seen reference to that ability but not sure how to wire it up. πŸ˜‡
βœ… 1
c
Hi! It’s
./pants update-build-files
that does that for you.
πŸ™Œ 1
πŸ‘ 1
r
AFAIK, formatting the BUILD files is part of the
update-build-files
goal
🎯 1
πŸ‘ 1
Any way to format
pants.toml
?
c
No, that would require a 3rdparty tool..
βœ… 1
r
OK
p
Awesome thanks!!
πŸ‘ 1
I'm (just) now understanding why that command uses a different interpreter constraints than the
[python.interpreter_constraints]
option. πŸ‘
h
ah yeah you can force it to use certain interpreter constraints with
[black].interpreter_constraints
btw there's been much discussion to merge
tailor
with
update-build-files
, and then possiblyyyy to merge some of that with
fmt
p
Fwiw I don't mind formatting the BUILD files with a separate command. But thanks for the context!
❀️ 1
My situation was that I had tool lockfile for black that reflected my
[python].interpreter_constraints
but when I would try to run
./pants update-build-files
it would fail because the lockfile didn't match
[black].interpreter_constraints
. Minor edge case but was confusing to me until now
πŸ‘ 1
πŸ‘€ 1
h
Would you mind opening a ticket explaining that edge case please? That's definitely confusing. https://github.com/pantsbuild/pants/issues/new/choose
p
I did:
find . -name BUILD | xargs black
locally and
find . -name "BUILD" | xargs python -m black --check
in ci (you have to have black installed locally or in CI somehow). I didn't try to move the new update build files goal....
p
@hundreds-father-404 will do!
πŸ™Œ 1
Alright, I did my best to capture what's going on here. https://github.com/pantsbuild/pants/issues/14912
❀️ 1