no-underscore-all-exports¶
Forbid exporting underscore-prefixed names from module __all__.
Message¶
Do not export underscore-prefixed symbols in __all__. Either remove them from __all__ or rename them to be public.
Settings¶
| Setting | Description | Type | Default |
|---|---|---|---|
| allow_dunder_exports | Allow double-underscore names such as __version__ in __all__. | bool | False |
| allowed_exports | Underscore-prefixed __all__ entries to allow by exact name. | list | [] |
Valid examples¶
__all__ = ["PublicThing", "public_thing"]
__all__: list[str] = ["public_name"]
__all__ = ("PublicThing", "public_thing")
EXPORTS = ["_private_name"]
__all__ = list(EXPORTS)
Show more
def build() -> None:
__all__ = ["_private_name"]
module.__all__ = ["_private_name"]
__all__ = ["__version__"]
__all__ = ["_C_API", "_Sentinel"]
Invalid examples¶
__all__ = ["_private_name"]
__all__: tuple[str, ...] = ("public_name", "_private_name")
__all__ += ["__version__"]