← Back to issue list

isort: automatic formatting/sorting of imports

View original Github issue

Metadata

Project
snapcraft
Number
#2819
Type
pull request
State
closed
Author
cjp256
Labels
—
Created
Updated
Closed

Current evaluation

Closed unmerged; author agreed to wait for a Black-compatible isort release and drop tools/format-code.sh. Superseded by merged PR #3344 (56c471f29), with #3351–#3354 and #3383 re-sorting imports.

Resolution: closed superseded

Reason: PR #2819 was never merged; in his closing comment cjp256 said it was fine to wait until a Black-compatible isort release was available and to drop the format-code script. That work landed instead in merged PR #3344 (commit 56c471f29, 'pyproject: add isort with black-compatible configuration'), followed by import-sorting PRs #3351, #3352, #3353, #3354 and #3383.

Evaluated by: mr-cal-bot

No scores available.

Issue body

This commit adds an isort configuration that's pretty close to black with one exception. - Add iscript config configuration that's pretty close to black with one exception. Ideally we'll enable this for a perfect match once available: https://github.com/psf/black/issues/251 - Add a script to format source code (tools/format-code.sh) reliably. - Add isort check (ignores whitespace) to static tests. - Actually format code. <-- this commit will need to be re-done once the current backlog of PRs is cleared (and this is ready to merge).

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed superseded Closed unmerged; author agreed to wait for a Black-compatible isort release and drop tools/format-code.sh. Superseded by merged PR #3344 (56c471f29), with #3351–#3354 and #3383 re-sorting imports.
stealth/space-bunny-alpha — closed superseded Proposal was set aside over format-code.sh concerns; a revised Black-compatible isort setup merged in canonical/snapcraft#3344 (56c471f29), followed by import-sorting PRs.
qwen/qwen3.6-35b-a3b — — Closed without merging. Reviewer concerns prompted the author to wait for an isort release compatible with black. The PR was abandoned pending upstream updates, with plans to drop the formatting script later.
qwen3.6-35b-a3b-mtp-q6 — — Closed without merging. Implementation was deferred pending an isort release compatible with black formatting, as the maintainer deemed the formatting script optional and preferred waiting for upstream improvements.

Update history

No update history recorded yet.

Related work

  • Superseded By: canonical/snapcraft#3344 (confidence 96%)

    Merged as 56c471f29; adds the Black-compatible isort configuration that #2819 proposed, without tools/format-code.sh.

  • Likely Fixed By: canonical/snapcraft#3383 (confidence 82%)

    'static: isort remaining python files' (d2f318468) applied the sorting that #2819's 'Actually format code' commit intended.

  • Related To: canonical/snapcraft#3351 (confidence 80%)

    First of the follow-up import-sorting PRs (d79d79bd2); #3352, #3353 (9abfb5071) and #3354 (59f915c5b) cover the other directories.

Related issues

Issue Project State Summary Similarity
#3354 cli: import sort with isort snapcraft merged Merged #3354 (59f915c5b): isort applied to the CLI package, reordering imports in 11 files (+22/-19). Part of the isort rollout started by #3344 and continued in #3351, #3352, #3353 and #3383.
76%
#3353 tools: import sort with isort snapcraft merged Merged as commit 9abfb5071: sorted imports with isort in snapcraft's tools/ files (+2/-5, 5 files), part of the repo-wide isort rollout started in #3344 alongside #3351, #3352, #3354 and #3383.
75%
#3352 tests: import sort with isort snapcraft merged PR #3352 merged as commit 195460f76, applying isort to test imports across 199 files (+313/-276), part of the isort rollout after config landed in #3344. isort was later replaced by ruff in #4012.
75%
#3344 pyproject: add isort with black-compatible configuration snapcraft merged Merged #3344 as 56c471f29, adding Black-compatible isort configuration; follow-ups #3351–#3354 and #3383 applied import sorting.
73%