I notice that some projects make use of the __all__ member in the __init__.py file to declare members that are part of the public API of a package.
I am wondering if this can be compared to module exports in JavaScript, for example.
And, if yes, if it would be a good thing if an inspection tool might show warnings whenever a client uses a member which is not listed in __all__?
then the __all__ inside ___init__.py only refers to imports using from starship import *, it says nothing about the starship.engine subpackage or starship.navigation, starship.shields and starship.weapons modules.
Each of those can have their own __all__. And remember that __all__ may not list all public names.
__all__cannot be used to declare the public API of an entire package, unless that package contains only a single module.
__all__can be used to declare the public API of a single module, but you cannot assume that it will be used that way.
You cannot assume that a module will have an __all__ attribute. If it does have one, you cannot assume that it includes the entire public API. Maybe it does, maybe it doesn’t.