How do I deal with common dependencies within a project?
Lets say I make a package, pack, with some modules, mod1 and mod2. All of the modules need to use some common external modules. For example:
mod1.py: import sys import numpy # define stuff mod2.py: import numpy # define more stuff I also want to use the same external modules in my main code:
main.py: import sys import numpy import pack # do the stuff In this situation I appear to have multiple copies of numpy and sys loaded i.e.:
numpy pack.mod1.numpy pack.mod2.numpy This seems bad. Do I really have multiple numpys or do I have one numpy with three names? Is there a way to avoid this sort of thing? What is the best practice in this case?