You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can you please point me to the place in documentation explaining how to use this in a Python module, i.e. in a file I use as an import?
So far I could easily find the if __name__ == "__main__": stuff which is for standalone applications.
What about supporting injection in an 'importable' module?
The use-case: I'm working on an AWS lambda and my code won't ever be run by itself, it will always be imported into another code (which I have no control over) and the lambda handler function will be called from there.
Is there any way to have everything instantiated/injected when my 'entry point function' gets called by external code?
All tutorials seem to be about standalone apps.
But if I initialize dependency injection in my main module (outside of the 'entry point function') then I'm confused about unit-testing.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Can you please point me to the place in documentation explaining how to use this in a Python module, i.e. in a file I use as an
import
?So far I could easily find the
if __name__ == "__main__":
stuff which is for standalone applications.What about supporting injection in an 'importable' module?
The use-case: I'm working on an AWS lambda and my code won't ever be run by itself, it will always be imported into another code (which I have no control over) and the lambda handler function will be called from there.
Is there any way to have everything instantiated/injected when my 'entry point function' gets called by external code?
All tutorials seem to be about standalone apps.
But if I initialize dependency injection in my main module (outside of the 'entry point function') then I'm confused about unit-testing.
Beta Was this translation helpful? Give feedback.
All reactions