Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

black version upgrade for v14 ?

by
Acsone SA/NV, Stéphane Bidoul
- 04/10/2020 14:16:18
Hi contributors,

I have a question for you, before creating the 14.0 branches. (I hope
it will not degenerate into a religious war, but I want to ask
nevertheless :)

The black code formatter we use has a new version that, among other
fixes and improvements, resolves the infamous trailing comma issue
[1]. It also does some reformatting in the docstrings. When we use it,
it therefore applies some different code reformatting here and there.

In the long run, using it is definitely a good thing. In the short
term I'm not so sure, hence this message.

So I see 3 possibilities:

1. keep black to the same version in 13 and 14 and wait until black
hits 1.0 to upgrade

This is the less disruptive approach right now but we need to continue
coping with the trailing comma "bug". This postpones the moment when
we will need to decide between options 2 and 3 below (possibly
involving more branches).

2. upgrade black now in 13 and 14

We can automate that but it will have the drawback of making some
existing 13.0 green PRs unmergeable, requiring manual intervention on
them before merging.

3. upgrade black in 14 and keep 13 as is, let PSC upgrade manually in
13 if they want to.

With this approach there will be some code formatting differences
between branches 13 and 14 which may make code migration slightly more
difficult, and may create some cherry-pick conflicts in forward- and
backports.

What are your thoughts / vote? In doubt, update
.pre-commit-config.yaml in your favorite repo to replace 19.10b0 with
20.8b1 and run "pre-commit run -a" to see what it does exactly.

[Note A similar reasoning exists for prettier but it mostly impacts
javascript-heavy repos only. So there I believe it's ok to upgrade
prettier in 14 and keep it as is in 13, especially since there were
some hacks necessary to use it in 13 that we don't want to carry over
in 14]

-sbi

[1] https://black.readthedocs.io/en/stable/the_black_code_style.html?highlight=comma#the-magic-trailing-comma

Follow-Ups