feat(dialogs): Incorporate DialogDependencies
Fixes #2218
Description
Dialog dependencies is a feature in
- botbuilder-js,
- and in botbuilder-dotnet.
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 check isinstance(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 and callable 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
- [x] Tests with coverage is added
- [x] pylint was run against the code, (although note that the pre-commit used uses a dependency that doesn't work in python 3.12, updating to
repo: https://github.com/pylint-dev/pylintwould be nice - [x] black was run against the code (note that some libraries are actually not properly formatted according to black!)