Removing import in __init__.py
See original GitHub issueI have a python package with a structure like:
.
├── setup.py
└── mypackage
├── __init__.py
└── mypackage.py
The contents of __init__.py
are as follows:
from .mypackage import *
Autoflake is removing all contents from __init__.py
breaking the package install. To fix the issue I’m asking autoflake to ignore __init__.py
Issue Analytics
- State:
- Created a year ago
- Comments:7
Top Results From Across the Web
Why delete modules in __init__.py? - Stack Overflow
It's a way to factor out functionality into submodules without making the submodules part of the public API. A quirk of the import...
Read more >Don't remove imports from __init__.py · Issue #35 - GitHub
A typical way to set up a project is to have the modules specify __all__ variables and then have the __init__.py from .module_name...
Read more >Remove an imported module in Python | bobbyhadz
The first step is to delete the sys.modules reference to the module we are trying to unload.
Read more >Understanding Python imports, __init__.py and pythonpath
The python interpreter tries to look for the directory containing the module we are trying to import in sys.path . It is a...
Read more >What is __init__.py used for in Python? - Net-Informations.Com
If you remove the __init__.py file, Python will no longer look for submodules inside that directory, so attempts to import the module will...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@urtubia thanks for sharing the reproducer. I see what’s going on now. Fix coming soon.
Hello! I’m running into a similar issue and I think this unittest shows the problem (I tested by including this test on
test_autoflake.py
)I ran this test on different release labels and I noticed that it passed on
v1.7.1
and started failing onv1.7.2