A poll: should the new `./pants update-build-files...
# general
h
A poll: should the new
./pants update-build-files
use Black by default, or you have to opt into it with an option? Beyond autoformatting, the goal automates fixing some safe deprecations like renaming target names + for opt-out, - for opt-in. Comments also welcomed :)
11
2
c
How about using black by default if that backend is listed in backend_packages in the configuration?
h
I think that we want to decouple using Black for your own code vs. BUILD files. For example, if you don't have any Python, you should not need to activate
pants.backend.python
to get this feature Or, if you have Python but aren't ready for Pants to run on in. Activating
pants.backend.python
would result in Python insisting with
./pants tailor
that it adds targets for Python code
(Still trying to think through though how interpreter discover + interpreter constraints should work here. Such as if we use
[black].interpreter_constraints
here. What about
[black].args
?)
How about using black by default if that backend is listed in backend_packages in the configuration?
Also generally I think it's a smell to have to document "The default depends if you set this other option." Makes it harder to reason about things. Keep It Simple
👍 1
c
In that case I think opt-in for using black on BUILD files.
To minimize surprises, and perhaps more importantly, the potential diff of changes applied.
h
That's the part tripping me up: the first time you run for existing users. You probably don't want Black enabled by default when upgrading from Pants 2.7 to 2.8 and to instead run it in a followup But, brand new users likely would want Black enabled by default with
update-build-files
. Even if they don't like Black for their own code, I imagine people are less opinionated with the formatting style of their BUILD files, as they're implementation details of a tool they use. So my personal vote is +1 to on-by-default, but then in our 2.8 release blog, maybe share a tip for existing users to use
--no-update-build-files-autoformat
the first time
c
Or how about always use black, but an option to disable all else. Then for existing users, you can do a fmt run first.
h
I think you should be able to turn off Black, but yeah agreed generally with that. I'm thinking we have
--autoformat
and
--fix-safe-deprecations
with default
True
for both Not sure if we need
--fix-safe-deprecations
to get more granular, like
--fixes=['renamed_targets', 'pex_entry_point']
. I don't think so, seems like overkill. Emphasis that the goal only does safe changes like renames
👍 1