late-future-import
What it does
Section titled “What it does”Reports a from __future__ import that comes after other statements.
Why it matters
Section titled “Why it matters”Python rejects the file with SyntaxError: from __future__ imports must occur at the beginning of the file. Only a docstring, comments and other future imports may come before it.
To fix, move the import to the top.
Example
Section titled “Example”...from __future__ import annotations...
import re...Configuration
Section titled “Configuration”python: lint: rules: late-future-import: warn # off, warn (default), errorEnabled by the presets: python/ruff.
Suppress one line with sudsy-disable-next-line late-future-import in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| ruff | F404 |
full |