Replace infoDicts with box (or similiar)

@Ivan I think this mainly goes in your direction.
In general I am not the biggest fan of passing info dictionaries as arguments/returnValues for functionCalls. This results in us having to just constantly check the docs about what is usable and what not.
With the typehinting coming I am suggesting the following:

  1. Add the box-package (python-box · PyPI) to TD and replace all dicts with Box-Objects, allowing dot-notation while keeping it backwards compatible.
  2. Add Protocoll-Classes to the typehinting and add them as typehints to the callbacks and return-values.
  3. Find a good way of creating custom-protocolls and passing them to callbacks for userdefined-structure in the infoDicts.
1 Like

Hey @alphamoonbase

This has been in discussion at Derivative for a while. We are now moving in the direction of using named tuples instead of dictionaries for callbacks with large amounts of data. I think the chances of us moving to a new data type again are pretty small, but if you think Box is significantly better, I’ll pass on a comparison doc if you feel like making one.

The main reason why I suggested Box is that it it is backwards compatible to dictionaries, meaning that the introduction would not break already existing callbacks while still providing a proper object-interface that lends itself to typehinting.

Ah, I somehow missed that when I looked at it before. That is pretty appealing indeed.

1 Like

You have an example of how a box would be type hinted? I couldn’t find one.