Skip to content

missing-required-import (I002)

Derived from the isort linter.

Fix is always available.

What it does

Adds any required imports, as specified by the user, to the top of the file.

Why is this bad?

In some projects, certain imports are required to be present in all files. For example, some projects assume that from __future__ import annotations is enabled, and thus require that import to be present in all files. Omitting a "required" import (as specified by the user) can cause errors or unexpected behavior.

Example

import typing

Use instead:

from __future__ import annotations

import typing

Options