-
Notifications
You must be signed in to change notification settings - Fork 15
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
#98 Increase granularity of context. #135
Conversation
# Conflicts: # that_depends/providers/context_resources.py # that_depends/providers/resources.py
@lesnik512 in particular, please review the documentation. I have written both a migration guide and extended the context resource documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
@alexanderlazarev0 Can I release 2.0? |
I think yes, but maybe make it a pre-release? |
@alexanderlazarev0 ok, will do today or tomorrow |
@alexanderlazarev0 here pre-release https://pypi.org/project/that-depends/2.0.0a0/ |
Implements #98
Split context into:
ContextResource
)API changes:
All API changes only come in the form of extending current functionality via methods or optional arguments. Except for:
To set the
global_context
when callingcontainer_context()
, one needs to explicitly pass it as a keyword arguments.Instead of:
Now one must use:
This makes the new API incompatible with the current version!
-> Hence, my suggestion is to release this with
2.0
Points of discussion:
I will leave comments to be discusses in this pull request.
Still TODO:
Implementation notes:
@lesnik512 I did some test approaches prior to this implementation. Keeping one
contextvars.ContextVar
for allContextResources
and modifying the dict is not really feasible since you would need todeepcopy()
the dict and its contents to the newly created context. In that case, one would need to look for a different solution fromcontextvars
.