Project structure
I have the following folder structure
|
|- src
| |- mypackage
| | |- __init__.py
| | |- mymodule.py
| |- utils.egg
|- main.py
in mymodule.py
file I can import the egg adding it to the sys.path
as
import sys
sys.path.append('src/utils.egg')
import utils
When calling main.py
everything works fine (python -m main
).
Problem
The problem comes from pylint
. First, it shows the following message in mymodule.py
file
Unable to import 'utils' pylint(import-error)
if I ask for suggestions (CRTL + Space
) when importing I got
utils.build
.dist
.utils
.setup
# |- suggestions
And from utils.utils
I can acces the actual classes / functions in utils
module. Of course if I import utils.utils
, when executing the main
script, an importing error pops up.
- How can I configure my vscode setting in order fix pylint?
- should I install the egg instead of copy it to the working folder?
- Is my project's folder-structure ok, or it goes against recommended practices?
Extra info
In case you wonder the EGG-INFO/SOURCE.txt
file looks like
setup.py
utils/__init__.py
utils/functions.py
utils.egg-info/PKG-INFO
utils.egg-info/SOURCES.txt
utils.egg-info/dependency_links.txt
utils.egg-info/top_level.txt
utils/internals/__init__.py
utils/internals/somemodule.py
utils/internals/someothermodule.py
Also, there aren't build
nor dist
folder in the egg.