Skip to content

Disallowing __all__ in WPS410 is not justified, nor is it customizable #3060

@webknjaz

Description

@webknjaz

What's wrong

https://wemake-python-styleguide.rtfd.io/en/latest/pages/usage/violations/best_practices.html#wemake_python_styleguide.violations.best_practices.WrongModuleMetadataViolation says this rule is about packaging metadata, however MODULE_METADATA_VARIABLES_BLACKLIST includes __all__ which cannot be fixed by following the recommendation of sticking its value into pyproject.toml since its function is fundamentally different.

__all__ is used in runtime and for Sphinx API doc generation. It does not hold what can be referred to as “metadata”.

How it should be

If it's desired to disallow __all__ for some reason, that reason should be stated explicitly and be its own rule. If it's to be kept in the same rule, that rule's justification needs to be updated and the list of disallowed names made customizable through a flake8 setting.

It should be possible to use __all__ to declare what's “public API” of a module without having to stick noqa in every single place or disabling the rule entirely.

Flake8 version and plugins

N/A

pip information

N/A

OS information

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions