I have a repo with this structure:
root_dir/
├── python/
│ └── libraries/
│ └──types/
│ ├── type1/
│ │ └── math/
│ │ └── math.py
│ └── type2/
│ └── categories/
│ └── category1/
│ ├── module1/
│ │ └── module1.py
│ ├── module2/
│ │ ├──module2.py
│ │ └── test/
│ │ └── test_module2.py
│ └── module3/
│ ├── module3.py
│ └── test/
│ └── test_module3.py
└── notebooks/
└── type1/
└── categories/
└── category1/
└── notebook.ipynb
How can I install root_dir\python\libraries\types\type1 as types.type1 and root_dir\python\libraries\types\type2\categories as types.type2.categories from the root directory root_dir
as two separate packages? I want to be able to import these modules to notebook.ipynb using:
from types.type1.math.math import Vector
from types.type2.categories.category1.module1.module1 import Calculator
from types.type2.categories.category1.module2.module2 import Processor
Adding a setup.py file to root_dir\python\libraries like this:
and a second setup.py file to root_dir\python\libraries\types like this:
has solved the problem. I can now use these import statements:
which works fine for my project.