Let’s say I have the following structure:
my_module/
__init__.py
utilities.py
and __init__.py
contains
from .utilities import SomeUtilityFunction
Is there a way to prevent or alert developers when they do
from my_module.utilities import SomeUtilityFunction
instead of
from my_module import SomeUtilityFunction
The problem arose when a few modules started using a function that was imported inside a module in which it wasn’t used, while also being available on the module’s __init__.py
, so after linting the file and removing the unused import my tests started failing.
any other advice for situations like this?
Bullshit!
module/__init__.py
:module/foo.py
:module/bar.py
:module/baz.py
:main.py
:Output:
No errors, warnings or anything.
You’re running python without linters? Interesting approach.
You can’t expect the user to have one.