I have written three Python modules, two of them are independent but the last one would depend on the two independent modules. For example, consider the following structure
myProject/
subpackage_a/
__init__.py
...
subpackage_b/
__init__.py
...
mainpackage/
__init__.py
...
mainpackage
depends on subpackage_a
and subpackage_b
, where as subpackage_a
and subpackage_b
can be used independently. In other words, in mainpackage
, there are references to subpackage_a
and subpackage_b
. In a nutshell, I want the user to be able to do from myProject import subpackage_a
and start doing subpackage_a.subfunction(args)
without calling mainpackage
. I also want the user to use from myProject import mainpackage
and start using mainpackage.mainfucntion(args)
, where mainpackage.mainfucntion
will call the functions in the subpackage
s.
I learned about namespace packaging. However, I couldn't find anything on namespace packages that involve dependencies. I don't have to use namespace packaging if there's a better solution. Can I get some suggestions on what I should look for?
subpackage_a
andsubpackage_b
are independent why make them subpackages and not independent libraries? – Beatrix