Skip to content

Disabling lazy loading in provide #73

@IvanKirpichnikov

Description

@IvanKirpichnikov

Idea:
I suggest adding the ability to disable lazy dependency loading for the 'provide' function or globally for the entire 'Provider'

How is it supposed to work?
When creating a new container, create all dependencies with the 'lazy=False' flag and add them to the cache.

Why do you need it?
Create resource-intensive sessions or pools, as well as detect errors early when creating dependencies and protect against errors during code execution

How I see it in the code
Provide

class MyProvider(Provider)
    a = provide(A, scope=Scope.App, lazy=False)

Provider

class MyProvider(Provider)
    lazy = Fasle
    a = provide(A, scope=Scope.App)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestto clarifyNeeds information or coordination with other issues

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions