Closed Bug 1724605 Opened 3 years ago Closed 3 years ago

Lando python auto-formatting doesn't match what lint expects

Categories

(Conduit :: Lando, defect)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: glandium, Assigned: zeid)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

53 bytes, text/x-github-pull-request
Details | Review

When D121944 landed, it triggered a black lint error, which was subsequently fixed by sheriffs.
The changes that landing did are: https://phabricator.services.mozilla.com/D121944?vs=468351&id=468355#toc
The changes that sheriffs undid are: https://hg.mozilla.org/integration/autoland/rev/a8d4d6248454

Locally, both the latest version of black and the version of black used by CI were happy with the patch before landing.

Zeid, do you know what is going on? Different version of black?
merci

Flags: needinfo?(zeid)
Attached file GitHub Pull Request (obsolete) (deleted) —
Assignee: nobody → zeid
Flags: needinfo?(zeid)

@sylvestre -- yes indeed this looks related to the black version. We have a patch that fixes this, we'll aim to land it asap.

Depends on: 1714229
The content of attachment 9235783 [details] has been deleted for the following reason: Replaced by https://github.com/mozilla-conduit/lando-api/pull/169

(In reply to Sylvestre Ledru [:Sylvestre] from comment #5)

What about using
https://searchfox.org/mozilla-central/source/tools/lint/python/black_requirements.in / https://searchfox.org/mozilla-central/source/tools/lint/python/black_requirements.txt
directly ?

This is going to be painful to maintain otherwise

Yes agreed -- the plan is to have a separate service or image that handles the formatting that does not rely on the Lando image. That will be replacing this way of running black in the future.

See Also: → 1714229

Lando is now running the updated version of Black and this particular issue is resolved. We are going to be revisiting the implementation of where the code formatters live (currently they are in the lando docker image, which is not ideal since we may need different versions and different formatters). :sheehan is there a bug tracking this already?

Status: NEW → RESOLVED
Closed: 3 years ago
Flags: needinfo?(sheehan)
Resolution: --- → FIXED

Lando is now running the updated version of Black and this particular issue is resolved.

I beg to differ. Lando is now using 21.5b2 and central uses 20.8b1. There is still room for this to happen.

Flags: needinfo?(zeid)

Yes that's correct, there is a version discrepancy, but the formatting issue that was encountered in this bug should not occur as the two versions should format the file the same way. There may be other inconsistencies but we will have to solve this problem in an alternate way in order to match the version. We're basically piggy backing off of the package that's used by Lando right now. The better solution would be to separate Lando's dependency from the formatter dependency, and as mentioned this is planned.

:glandium if you are running into a formatting issue right now with this current version, let me know and we can revisit this in the immediate term, otherwise let's wait until we have a better solution for version matching/pinning.

Flags: needinfo?(zeid)

:sheehan was there a specific reason we chose this exact version of black? Perhaps you can shed some light as well here.

Here's a try with black 21.5b2: https://treeherder.mozilla.org/logviewer?job_id=348138013&repo=try&lineNumber=122
All the files reported there will have the issue reported here if they're modified by a patch and land with lando.

Ah -- ok, I will update the version to match manually for now, until we have a long term solution for this.

Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Depends on: 1725247

Actually, reformatting them with black 21.5b2 first and linting with black 20.8b1 doesn't yield errors.

(In reply to Zeid Zabaneh [:zeid] from comment #8)

Lando is now running the updated version of Black and this particular issue is resolved. We are going to be revisiting the implementation of where the code formatters live (currently they are in the lando docker image, which is not ideal since we may need different versions and different formatters). :sheehan is there a bug tracking this already?

I thought there was but I could not find it - filed bug 1725247.

(In reply to Zeid Zabaneh [:zeid] from comment #11)

:sheehan was there a specific reason we chose this exact version of black? Perhaps you can shed some light as well here.

Hmmm I was under the impression we ran the latest black, but it seems that was wrong. We could either revert Lando's black to v20 or bump the in-tree version to v21. This will be fixed once we address bug 1725247.

Flags: needinfo?(sheehan)
Attached file GitHub Pull Request

This should now be fixed, please let me know if the issue is persisting for any reason.

Status: REOPENED → RESOLVED
Closed: 3 years ago3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: