Replies: 2 comments 3 replies
-
|
It is hard to keep that comparison in actual form having a big amount of libraries there. Talking about compilation feature: it looks similar to what we have in dishka since the first public release. It is really essential for perfomance. In new version (not yet release) I have rebuilt this code a lot to enable more complex feature like conditional activation |
Beta Was this translation helpful? Give feedback.
-
|
So, talking about code generation. Let's say we have a class, registered in container class GatewayImplementation(Gateway):
def __init__(self, config: Config, connection: Connection):
...
provider.provide(GatewayImplementation, provides=Gateway)During preparation step we gather its dependencies as a list, store flags and so on. solved = factory.source(*(
getter(key) for key in factory.dependencies
))
if factory.cache:
cache[factory.provides] = solvedThere are few things here which can be optimized:
So, we can generate the code in form: solved = GatewayImplementation(getter(key_Config), getter(key_Connection))
cache[key_GatewayImplementation] = solved
return solvedThis will work much faster |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi 👋
I was comparing the API surface of Python DI libraries and in the end I've found 2 I like: Dishka and Wireup.
Since you're already providing a comparison with other DI libraries, a comparison with one that feels very similar on the surface would be helpful.
The API surface and functionality is very similar. I've mocked exactly the same "app" with both.
One thing that caught my attention in
Wireupis "compilation" which was added in v2.2.0.I kinda like Dishka's API more, but would love a more technical comparison from someone who knows what to look at.
Beta Was this translation helpful? Give feedback.
All reactions