New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wire without cascading import #441
Comments
@ssheng Please check this section of the docs: https://python-dependency-injector.ets-labs.org/wiring.html#wiring-of-dynamically-imported-modules You could also avoid using of import one
import two
...
if __name__ == '__main__':
container.wire(modules=[one, two]) Best, |
Thanks, @rmk135 for the quick response. However, I'm getting the following error. I've tried
Thanks, |
Hey @ssheng , The issue comes from wiring not properly working with |
@ssheng I fixed the issue in version |
Thanks for the resolution, @rmk135. I upgraded to version However, I ran into another issue which could be specific to the project I was working on. I was getting the following error message suggesting that
I wonder if any logic in |
Hi @ssheng ,
Also when you set multiprocessing start method you might need to initialize DI explicitly again. Check out this issue: #340 |
Thanks, @rmk135. I managed to get it work with some refactoring. The issue was not related to spawn but Gunicorn. I found out that the performance of a CLI tool we built using dependency-injector became significantly slower after using CLI timing with CLI timing with |
First of all. Thanks for creating and maintaining this great library. I have a question regarding wire.
It seems like wire does a pkgutil.walk_packages and import all modules through importlib.import_module. This prevents the ability to lazily import dependencies as they are needed especially when there are large libs like numpy and grpcio involved. What is the recommendation to wire without cascading imports?
Thanks,
Sean
The text was updated successfully, but these errors were encountered: