You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by GitBox <gi...@apache.org> on 2021/02/05 10:25:46 UTC

[GitHub] [buildstream] BuildStream-Migration-Bot opened a new issue #1388: Review typing hints (PEP 484) (especially List)

BuildStream-Migration-Bot opened a new issue #1388:
URL: https://github.com/apache/buildstream/issues/1388


   [See original issue on GitLab](https://gitlab.com/BuildStream/buildstream/-/issues/1388)
   In GitLab by [[Gitlab user @tristanvb]](https://gitlab.com/tristanvb) on Aug 27, 2020, 13:42
   
   Since we started introducing the static type checking with `mypy`, we have been happily adding static type checking to the API surface, and now also internally.
   
   I have noticed that we use `List` in the codebase in a few places, and I think that we did this mostly lazily without considering other, more relaxed options, like `Sequence` or `Iterable`.
   
   In various cases, the API would be perfectly happy accepting a `Sequence` as an argument and not require that it actually be a `List` type, in these cases we should relax the type hints. Likewise with return values, we should avoid making a promise about a return value being a `List` when the API use cases would be satisfied with any `Sequence` or `Iterable`.
   
   I suggest that we do a passover review of the API annotations when we are closer to `2.0`, after an API freeze.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [buildstream] gtristan commented on issue #1388: Review typing hints (PEP 484) (especially List)

Posted by GitBox <gi...@apache.org>.
gtristan commented on issue #1388:
URL: https://github.com/apache/buildstream/issues/1388#issuecomment-925533137


   The types hints in the public API have been reviewed such that we use `Iterable` instead of `List` for types which we hand over to the plugin, essentially we want to be more specific when the plugin hands the core some data, so that the core can rely on receiving strongly specified types, and we want to be vague when handing data to a plugin, so that the core retains more freedom (which is why we give the plugin `Iterable` instead of `List`).
   
   This is closed with #1518
    


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [buildstream] gtristan closed issue #1388: Review typing hints (PEP 484) (especially List)

Posted by GitBox <gi...@apache.org>.
gtristan closed issue #1388:
URL: https://github.com/apache/buildstream/issues/1388


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org