Skip to content
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

ContextResource that supports auto-context #139

Closed
alexanderlazarev0 opened this issue Jan 11, 2025 · 1 comment · Fixed by #148
Closed

ContextResource that supports auto-context #139

alexanderlazarev0 opened this issue Jan 11, 2025 · 1 comment · Fixed by #148
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@alexanderlazarev0
Copy link
Collaborator

alexanderlazarev0 commented Jan 11, 2025

Right now, a context always needs to be initialized before resolving a providers.ContextResource:

with my_context_resource.sync_context():
    my_context_resource.sync_resolve():

It would be great to support automatically initializing a context when one attempts to resolve a context-resource:

my_context_resource = providers.ContextResource(my_sync_creator, auto_context=True)

my_context_resource.sync_resolve() # `Does not throw Exception`
@alexanderlazarev0 alexanderlazarev0 added the enhancement New feature or request label Jan 11, 2025
@alexanderlazarev0 alexanderlazarev0 self-assigned this Jan 11, 2025
@lesnik512 lesnik512 linked a pull request Jan 13, 2025 that will close this issue
@lesnik512
Copy link
Member

@alexanderlazarev0 But how to finalize such resource after using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants