Import modules in an upper level to not cause issue while monkeypatching
pep8 recommendations to import just the necessary function used in the code.
And following what I heard about importing just the minimum to speed-up the program start-up, and may be decrease the memory usage by keeping the minimum libs in the memory.
This two above statement made silkaj runtime code just import the strict minimum of what's used.
We are now starting to write more and more tests, and this caused troubles. Monkeypatching wasn't working due to import issues.
This article explains why the monkey patching is sometimes not working due to import issues. As a summary, this is due to how the modules are imported. Once imported and cached, it can not be changed. But, if you import at a higher level, via the above module, the patching is working.
This ticket is just about changing the modules import, by importing them from a higher level:
from silkaj import tx tx.send_transaction() tx.confirmation_chart()
We could import a whole file, a class, but not a function nor a method, otherwise we would get annoyed by non-working monkeypatching.
This also allow to know from which library the f() is coming from, the context. There will be less effort tracking which function is use/is no more used and can be removed.
The idea is to get into this direction. We could still import function and method if wished.