My package structure looks like this
mypackage
│ LICENSE
│ pyproject.toml
│ README.md
│ requiremets.txt
├───docs
├───scripts
├───src
│ └───mypackage
│ config.py
│ first_module.py
│ second_module.py
│ __init__.py
└───tests
the content of my __init__.py is this
from .first_module import * # NOQA
from .second_module import * # NOQA
and in second_module.py I have the following
from .first_module import * # NOQA analysis:ignore
I run pip install -e . to have my package in the right place while developing.
My second_module.py is full of these warnings
'myfunction' may be undefined, or defined in star imports .first_module (pyflakes E)
and these errors
'MY_CONST' is not defined (mypy)
How to disable such warnings/errors? If it may be useful, I am using the following IDE
* Spyder version: 5.2.2 None
* Python version: 3.9.12 64-bit
* Qt version: 5.9.7
* PyQt5 version: 5.9.2
* Operating System: Windows 10
I have found similar questions here and here and I am aware that star imports shall be avoided, but I also read that when developing a package with the described structure (which is one of the recommended btw), then using star imports in such a specific manner is the way to go.
EDIT: I found a way for circumnavigating it and it is to add a # noqa at the end of each line where I get the warning. But that happens on a tons of lines and it is very annoying to fix the code in this way.
EDIT 2: I have tried to create a ~/.flake8 file with the following content
[flake8]
extend-ignore = F403,F405
But it didn't work. I also tried replacing extend-ignore with ignore but I got the same result.
EDIT 3:
I observed that by having the aforementioned .flake8 file in my project root folder and by running flake8.exe ./src/mypackage/first_module.py, then F405 is correctly ignored, but running pyflakes.exe ./src/mypackage/first_module.py the F405 warning is still there.
Hence, once shall tell pyflakes to add extend-ignore = F403,F405 to its flake8 config file, but is not possible since pyflakes does not use any config file..