You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First argument should be more like asyncio.Queue[Dict[str, Any])]
The args being just a generic Dict[str, Any] might not be the best type due to the use of Any - gives too much freedom and does not help plugin authors to easily write them. It would be desirable to be a more constrained type, if possible. Even defying a specific class for this purpose might help as plugins could import it for typing purposes.
Environment
Steps to reproduce
Actual results
Expected results
Complete type signature, maybe even including some examples of what kind of data would be received by the plugins.
It is a good catch @ssbarnea
Actually, the payload passed through the queue as dict is going to be converted into a json afterwards, so we actually require the native types that are supported for a json string.
Please confirm the following
Bug Summary
The example given in https://ansible.readthedocs.io/projects/rulebook/en/latest/sources.html#plugin-template does have incomplete type signature (running mypy --strict would highlight the issues).
asyncio.Queue[Dict[str, Any])]
Environment
Steps to reproduce
Actual results
Expected results
Complete type signature, maybe even including some examples of what kind of data would be received by the plugins.
Additional information
It should be noted that I found this while adding types to EDA collection as part of ansible/event-driven-ansible#258
If the data passed is generic JSON, it could prove useful to know that now we do have some JSON types compatible with mypy, we already defined them in https://github.com/ansible/ansible-compat/blob/main/src/ansible_compat/types.py#L13 as we needed them for several projects managed by devtools, feel free to copy them.
The text was updated successfully, but these errors were encountered: