STRUCT005infoPro

relative-imports

Relative import used instead of absolute import.

Applies to: Python

Why this matters

Relative imports (from . import x, from .. import y) are fragile and confusing. They break when files are moved and make it harder to understand where code comes from. Absolute imports (from mypackage.module import x) are explicit and reliable.

Catch it before it ships

pip install stablestack # or: npx stablestackstablestack # scans your project, STRUCT005 includedstablestack explain STRUCT005

STRUCT005 is part of the Pro rule set. See pricing — the free tier ships 24 checks with no signup.

False positive in your codebase? Suppress a single line with # noqa: STRUCT005