Private module import inspection¶
This inspection reports imports from private implementation modules when the imported symbol is already available from the public package API.
Example¶
If package.__all__ exports User, BetterPy suggests importing from package instead:
When the symbol is not exported yet, the inspection can also make the symbol public by updating the package __all__, adding the re-export import, and rewriting matching private imports outside that package.
Notes¶
- The inspection helps keep callers on public package APIs.
- Imports inside the exporting package are left alone, so implementation modules can still use private package internals.
- It is gated by the Private module import inspection setting under Settings | BetterPy | Code Quality & Safety | Import Inspections.