feat(dialogs): Incorporate DialogDependencies #2219
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.
Fixes #2218
Description
Dialog dependencies is a feature in
To maintain feature parity, and because this functionality is extremely useful this PR brings it to
botbuilder-python
.Specific Changes
Tecnically in the
botbuilder-js
and dotnet implementations dialogs that are found to conflict get stored with a different ID, but I am sure that would likely be a breaking change (and IMO a very counter-intuitive way of working).If you are adding dialog dependencies and they conflict, the logic as it was would be retained.
Note that, although by making it a
@runtime_checkable
Protocol with DialogDependencies one can checkisinstance(object, DialogDependencies)
, the recommendation from the python docs is:"check against a runtime-checkable protocol can be surprisingly slow" — python typing
For that reason we use
hasattr
andcallable
instead.Also, note that protocol is avaialble from python 3.8 onwards, which is already the minimum version for this library.
The purpose of using Iterable instead of List is just to keep it generic. Since python has the concepts of
tuple
,List
, etc and to keep it as a structural type.Testing
repo: https://github.com/pylint-dev/pylint
would be nice