Skip to content

F401 (imported but not used) in __init__.py #471

Description

@crusaderky

Virtually every medium to large library package I've encountered so far is structured as follows:

  • impl.py defines objects
  • __init__.py imports them, so that the library users don't need to know about impl.py.

At the moment, the __init__.py modules of packages that use flake8 are littered with either # noqa: F401 on every single line or # flake8: noqa at the top of the module which blanket disables everything.

This change request is to add a special case in pyflakes that disables F401 (only) when the file name is __init__.py.
An alternative approach would be to add to flake8 the ability to suppress specific errors at module level, e.g. # flake8: noqa: F401.

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