I am working on a project where all the code in the source tree is divided into module directories, for example:
modules/check/lib/check.py
modules/edit/lib/edit.py
During installation, Python files are placed in the same directory program_nameunder Python site-packages. Therefore, all modules use syntax import program_name.edit.
Due to the directory structure and import, the source modules cannot import each other, so you will have to install them every time you want to run something in the source tree.
Therefore, my questions are: without changing the directory structure, how can I be sure that I modules/check/lib/check.pyimport from modules/edit/lib/edit.pyand what I site-packages/program_name/check.pyimport from site-packages/program_name/edit.py? And for a possible reorganization, what are the best practices for directory structure and import in such an environment?
source
share