botbuilder-python icon indicating copy to clipboard operation
botbuilder-python copied to clipboard

feat(dialogs): Incorporate DialogDependencies

Open alexrecuenco opened this issue 11 months ago • 0 comments

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 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/pylint would be nice
  • [x] black was run against the code (note that some libraries are actually not properly formatted according to black!)

alexrecuenco avatar Mar 23 '25 01:03 alexrecuenco