Skip to content

PY-TYPE0001 · future_annotations_import

Detect PEP 563 annotation stringization in Python 3.14 projects.

This is a deterministic rule for python. Read its implementation.

Report from __future__ import annotations when the configured minimum Python 3 minor version is 14 or newer. Python 3.14 provides deferred annotation evaluation through PEP 649 and PEP 749 without the import. Keeping it instead selects the older PEP 563 stringized representation. A plain one-line import receives a review fix that removes the full line.

Each finding identifies the future import and includes a source-preserving byte edit when removal does not share a line or statement with other code.

Keep the import when software intentionally depends on PEP 563 stringized runtime annotations. The import remains supported in Python 3.14 and is planned for deprecation only after Python 3.13 reaches end of life. The fix requires review because removal changes runtime annotation representation even though ordinary static annotations remain valid. The project configuration table supplies the minimum supported Python minor, so a project still supporting an older interpreter stops asking for syntax that release does not have.

A module targeting Python 3.14 that states from __future__ import annotations returns true and can drop that line. The same module without the import returns false, and so does any module in a project whose declared minimum is below 14.

  • Adapts Pylint W0410 misplaced-future
  • Cites “What’s New In Python”, from __future__ import annotations. Open reference
  • Cites “PEP 649, Deferred Evaluation of Annotations”. Open reference
  • Cites “PEP 749, Implementing PEP 649”, the future of PEP 563. Open reference