Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Ghost
    @ghost~576aa099c2f0db084a1f5559
    Artem Malyshev
    @proofit404
    Hi!
    We can add injectable objects right to the Django routing, Celery app, Py.test fixture and similar.
    The only difference - we do it by name instead of type
    But I wander, is it possible to have multiple DB subclasses in the DI process0
    ?
    Ghost
    @ghost~576aa099c2f0db084a1f5559
    I am not sure about multiple DBs
    Artem Malyshev
    @proofit404
    Now we have FAQ section in the docs: https://dependencies.readthedocs.io/en/latest/faq.html
    Ghost
    @ghost~576aa099c2f0db084a1f5559
    Thanks! I was hoping to see this type-annotation feature. But, sadly you do not like it.
    I have some feedback and questions about your reasoning.
    1. While I still seem to understand your point here: "It hard to tell what dependencies will be resolved based on container definition. You need to look at many different things at the time: a signature of the init method, container definition, base type of each class registered in the container"
    I would love to see an example where this can be clearly visible. And I would love to see inject-by-name way to compare them. How does this sound to you?
    2! Container definition can be split into different files which make it harder to read
    But modularity is a good thing, isn't it? And how does this work with names? What is the difference? That's not clear to me at all.
    3) Typo in "I hard"
    Ghost
    @ghost~576aa099c2f0db084a1f5559
    4] That's a valid point about different subtypes, but is possible to solve. Once can use different subtypes to define what needs to be injected. Or it is possible to use a combination of type/name to solve this case
    (I had to use different bullets styles, since gitter screws up the markup)
    Artem Malyshev
    @proofit404
    Thanks for the feedback!
    Artem Malyshev
    @proofit404
    I hope this two slides has explanation why declarative containers has less code and clear function/object names:
    https://dry-python.org/static/slides/making_architecture_matter.html#/25
    https://dry-python.org/static/slides/making_architecture_matter.html#/26
    Artem Malyshev
    @proofit404
    Also, I have plans to support type annotation, but in a different way: check that injected argument matched expected annotation
    Ghost
    @ghost~576aa099c2f0db084a1f5559
    @proofit404 that's a good idea!
    I am currently reading Hanami guide https://guides.hanamirb.org/architecture/interactors/ I have missed it for some reason, but it is great!
    Artem Malyshev
    @proofit404
    This is a nice video about DI and IoC: https://www.youtube.com/watch?v=pV-YKZEqsQ4
    Got some inspiration from it dry-python/dependencies#64

    I'll try to implement django middlewares support in the dependencies

    Each middleware can return injector subclass.
    Next middleware can depend on attributes defined in this subclass.
    View can depend on attributes defined by all middlewares.