Summary
# Before
from __future__ import annotations
from pathlib import Path
type Paths = list[Path] # Ruff should raise an error to move path to a type checking block
# After
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from pathlib import Path
type Paths = list[Path]
I can run the code in the second example and python does not raise an error. I believe this is valid with type aliases.
I would like ruff to tell me to move the pathlib import under a type checking block.
Version
No response