Proposal: Have the json_schema_compiler formatted with yapf

15 views
Skip to first unread message

Claudio DeSouza

unread,
Mar 21, 2023, 11:50:11 AM3/21/23
to extensions-dev
Hello everyone,

Chromium by default uses yapf (I think) to format python code. However, when it comes to the json_schema_compiler, we have to do all formatting manually.

I think there would be value in doing a general pass to normalise then code, then adding that hash to list of hashes git ignores when doing git blame.

Thoughts?

Mike Frysinger

unread,
Mar 21, 2023, 11:53:44 AM3/21/23
to Claudio DeSouza, extensions-dev
if we're going to reformat code, please use black, not yapf.  we've been discussing similar things on pyt...@chromium.org.
-mike

--
You received this message because you are subscribed to the Google Groups "extensions-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to extensions-de...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/extensions-dev/48d02a68-9ac5-44f0-b0b1-1af72f950b0en%40chromium.org.

Claudio DeSouza

unread,
Mar 21, 2023, 12:38:29 PM3/21/23
to extensions-dev, extensions-dev
Hello Mike,

Would you mind pointing out somewhere in Chromium where black is being used, so I can have a reference point for a run?

Claudio.

On Tuesday, March 21, 2023 at 3:53:44 PM UTC Mike Frysinger wrote:
if we're going to reformat code, please use black, not yapf.  we've been discussing similar things on pyt...@chromium.org.
-mike

On Tue, Mar 21, 2023 at 11:50 AM Claudio DeSouza <cdes...@chromium.org> wrote:
Hello everyone,

Chromium by default uses yapf (I think) to format python code. However, when it comes to the json_schema_compiler, we have to do all formatting manually.

I think there would be value in doing a general pass to normalise then code, then adding that hash to list of hashes git ignores when doing git blame.

Thoughts?

--
You received this message because you are subscribed to the Google Groups "extensions-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to extensions-dev+unsubscribe@chromium.org.

Mike Frysinger

unread,
Mar 23, 2023, 12:31:01 AM3/23/23
to Claudio DeSouza, extensions-dev
i was misremembering slightly.  while we seemed to agree that black was a good thing, and to reformat existing 2-space code to 4-space to align with the rest of the world, we ended up still using yapf but with 4-space indent in its config.

so i think work would have to be done in git_cl.py first to opt-in to black, and then have it enforce/leverage black from depot_tools.  i get that you prob don't want to shave that yak.

so yes, let's reformat the code so it can be automated/enforced, and pick a yapf config style file that aligns with black as much as possible.
-mike

On Tue, Mar 21, 2023 at 12:38 PM Claudio DeSouza <cdes...@chromium.org> wrote:
Hello Mike,

Would you mind pointing out somewhere in Chromium where black is being used, so I can have a reference point for a run?

Claudio.

On Tuesday, March 21, 2023 at 3:53:44 PM UTC Mike Frysinger wrote:
if we're going to reformat code, please use black, not yapf.  we've been discussing similar things on pyt...@chromium.org.
-mike

On Tue, Mar 21, 2023 at 11:50 AM Claudio DeSouza <cdes...@chromium.org> wrote:
Hello everyone,

Chromium by default uses yapf (I think) to format python code. However, when it comes to the json_schema_compiler, we have to do all formatting manually.

I think there would be value in doing a general pass to normalise then code, then adding that hash to list of hashes git ignores when doing git blame.

Thoughts?

--
You received this message because you are subscribed to the Google Groups "extensions-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to extensions-de...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "extensions-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to extensions-de...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/extensions-dev/3103e957-3e3a-4e56-80d8-f1e5ee5b8606n%40chromium.org.

Claudio DeSouza

unread,
Mar 30, 2023, 12:32:05 AM3/30/23
to extensions-dev, extensions-dev
Thanks Mike for the feedback.

Claudio.

On Thursday, March 23, 2023 at 4:31:01 AM UTC Mike Frysinger wrote:
i was misremembering slightly.  while we seemed to agree that black was a good thing, and to reformat existing 2-space code to 4-space to align with the rest of the world, we ended up still using yapf but with 4-space indent in its config.

so i think work would have to be done in git_cl.py first to opt-in to black, and then have it enforce/leverage black from depot_tools.  i get that you prob don't want to shave that yak.

so yes, let's reformat the code so it can be automated/enforced, and pick a yapf config style file that aligns with black as much as possible.
-mike

On Tue, Mar 21, 2023 at 12:38 PM Claudio DeSouza <cdes...@chromium.org> wrote:
Hello Mike,

Would you mind pointing out somewhere in Chromium where black is being used, so I can have a reference point for a run?

Claudio.

On Tuesday, March 21, 2023 at 3:53:44 PM UTC Mike Frysinger wrote:
if we're going to reformat code, please use black, not yapf.  we've been discussing similar things on pyt...@chromium.org.
-mike

On Tue, Mar 21, 2023 at 11:50 AM Claudio DeSouza <cdes...@chromium.org> wrote:
Hello everyone,

Chromium by default uses yapf (I think) to format python code. However, when it comes to the json_schema_compiler, we have to do all formatting manually.

I think there would be value in doing a general pass to normalise then code, then adding that hash to list of hashes git ignores when doing git blame.

Thoughts?

--
You received this message because you are subscribed to the Google Groups "extensions-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to extensions-dev+unsubscribe@chromium.org.

--
You received this message because you are subscribed to the Google Groups "extensions-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to extensions-dev+unsubscribe@chromium.org.
Reply all
Reply to author
Forward
0 new messages