ThirVondukr / aioinject

Async-first python dependency injection library
https://thirvondukr.github.io/aioinject/
MIT License
30 stars 2 forks source link

Support deffered types #2

Closed nrbnlulu closed 10 months ago

nrbnlulu commented 10 months ago

fix #1

nrbnlulu commented 10 months ago

mostly because it'll probably mean that you'd have a circular dependency somewhere.

I needed that due to if TYPE_CHECKING blocks. If have some abstract class that have dependencies you usually won;t use them in the abstract class itself. assuming that the implementations are in different modules.

ThirVondukr commented 10 months ago

mostly because it'll probably mean that you'd have a circular dependency somewhere.

I needed that due to if TYPE_CHECKING blocks. If have some abstract class that have dependencies you usually won;t use them in the abstract class itself. assuming that the implementations are in different modules.

I'm not saying you're doing something wrong, you must've had a valid use case for that, also probably with new python versions when from __future__ import annotation behavior becomes the default that change would have to be made, though, not sure how that would work anyway.

ThirVondukr commented 10 months ago

I didn't include settings default = None for _cached_dependencies and _cached_type, but I think expecting AttributeError should work too, I think this can be merged