I am building my first ever python package, currently I have this structure:
my_project_root_dir/
└--package_name/
└--networking/
|--__init__.py
└--service_discovery.py
|--__init__.py
└--adapter.py
|--README.md
└--setup.py
Then in adapter.py
i have import statement:
from package_name.networking.service_discovery import ServiceDiscovery
In package_name.__init__.py
:
__all__ = ['networking']
In networking.__init__py
:
__all__ = ['service_discovery']
In networking.service_discovery.py
there is class definition of ServiceDiscovery
And then when I try to install locally this package into different virtual environment through: pip install /path-to-project-dir/my_project_root_dir
And run in python console import package_name.adapter
I get the error:
ModuleNotFoundError: No module named 'package_name.networking'
with the traceback to adapter.py
file