Skip to content

UP029 false positive on relative imports from local .builtins module #21307

@amyreese

Description

@amyreese

Summary

Discovered when running ruff on aioitertools, which reimplements several builtins as async-compatible variants, where UP029 incorrectly flags imports from the local .builtins module as unnecessary imports:

amethyst@espeon ~/workspace/aioitertools ruff+ » cat foo.py
from .builtins import next

amethyst@espeon ~/workspace/aioitertools ruff+ » uv run ruff check --isolated --select UP029 foo.py
UP029 Unnecessary builtin import: `next`
 --> foo.py:1:1
  |
1 | from .builtins import next
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
help: Remove unnecessary builtin import

Found 1 error.
No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option).
> [1]

Version

ruff 0.14.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions