BerriAI / litellm
github.com·3d ago

TL;DR
Python's __all__ variable allows developers to control which objects are imported with wildcard imports, enhancing clarity and maintainability. By defining __all__, you can specify exactly what is exposed from a module or package.
✦ Why It Matters
Define __all__ in your modules today to improve code clarity and prevent unintended imports.
Key Takeaways
How It Works
The __all__ variable is defined as a list of strings, where each string corresponds to a name of an object you want to expose. When a wildcard import is performed, only the names listed in __all__ are imported into the namespace, preventing unintended access to private or internal components.