Repository navigation
feat!: require modern-di 4 and look up providers with Container.find_provider - #39
Merged
Merged
Conversation
…provider modern-di 4.0 makes Container.providers_registry private and adds Container.find_provider. Reword the test helper comment for the 4.0 rule that a registered ContextProvider with no value raises.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs modern-python/modern-di#579.
Summary
modern_di_grpc/main.pyandtests/test_inject.pycallcontainer.find_provider(ServicerContext). modern-di 4.0 makesproviders_registryprivate and addsfind_provideras its public replacement.find_providerexists only in 4.0, so the requirement is nowmodern-di>=4,<5. This drops 3.x support, hencefeat!.tests/dependencies.py: the comment on_make_context_readerdescribed 3.x optional-context behaviour. In 4.0 a registeredContextProviderwith no value raisesContextValueNotSetError, so theNonedefault only applies in a container where noDIInterceptorregisteredgrpc_context_provider. The comment now says that.Verification
>=4andfind_providerdoes not exist in 3.x.CI will fail to resolve dependencies until modern-di 4.0.0 is on PyPI. This PR stays a draft until then.