Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

How to install local python modules in subdirectories as separate packages from the root directory?

$
0
0

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_diras two separate packages? I want to be able to import these modules to notebook.ipynb using:

from types.type1.math.math import Vectorfrom types.type2.categories.category1.module1.module1 import Calculatorfrom types.type2.categories.category1.module2.module2 import Processor

Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>