Check import order in CI and sort the files that had drifted - #489
Open
jmchilton wants to merge 2 commits into
Open
Check import order in CI and sort the files that had drifted#489jmchilton wants to merge 2 commits into
jmchilton wants to merge 2 commits into
Conversation
.isort.cfg and `make format` have configured isort all along, but nothing ran it: the lint env installs flake8 alone, so 71 files had drifted out of order. Add a format env that runs `isort --check --diff .`, matching what `make format` rewrites, and give it a CI leg. It runs on 3.14 only. The lint job also covers 3.7, and isort dropped 3.7 after 5.11, so the two legs would resolve different versions and could disagree. Drop the import-order-style and application-import-names settings from setup.cfg. They configure flake8-import-order, which is not among the lint deps, and smarkets style disagrees with the isort profile that is actually in use. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Mechanical `isort .` pass over the files that had drifted. No behavior change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR description was drafted and posted by Claude (AI assistant) on jmchilton's behalf.
Summary
.isort.cfgand themake formattarget have configured isort in this repo all along — the settings are nearly identical to Galaxy's (profile=black,force_alphabetical_sort_within_sections,reverse_relative,force_grid_wrap=2; onlyline_lengthand the skip paths differ). Nothing ever ran it in CI, so 71 files had drifted out of order.Two commits, and the second one is the boring one:
Check import order in CI— the part worth reviewing. Aformattox env runningisort --check --diff ., plus a CI leg.Sort imports with isort— a mechanicalisort .pass. No behavior change.This came up because
lib/galaxy/jobs/runners/htcondor.pyfailed Galaxy's isort check on galaxyproject/galaxy#23326, in an import block copied over frompulsar/managers/queued_htcondor.py. Galaxy caught it; Pulsar could not.Notes for review
Why the format env runs on 3.14 only. The lint job matrix covers 3.7 and 3.14. isort dropped 3.7 support after 5.11, so the two legs would resolve different isort versions and could disagree about the same file. A single 3.14 leg avoids that; this also mirrors how Galaxy keeps
formatseparate fromlint.Why it checks
.rather thanpulsar test. That matches whatmake formatrewrites, sotools/anddocs/stay sorted too and the check never disagrees with the fixer.Dead config removed.
setup.cfgcarried:Those configure
flake8-import-order, which is not in the lint deps, so they have never had any effect. They also describe a different convention from the isort profile actually in use — smarkets wantsimport Xbeforefrom X import, which black-profile isort does not enforce. If anyone installed the plugin the two would fight, so they are better gone than latent.Blast radius
isort --check .inspects the whole tree, so once this lands, open PRs branched from before it will fail the new check until they rebase. Worth timing accordingly.Validation
tox -e formatpasses on the sorted tree; deliberately unsorting one import block makes it exit 1, so the check demonstrably catches drift rather than just passing.tox -e test-unitequivalent: 241 passed, 1 failed —wsgi_app_test.py::test_standard_requests, which fails identically on unmodified master.