Re: [BuildStream] Proposal: Consider adding type hints



Hi Gokcen,

On 10/07/2019 12:09, Gökçen Nurlu via buildstream-list wrote:
[...]

How much type-inference we want to see in the code: none, some, as
much as we can?

I think it's definitely worth doing this for function/class
declarations. More than that might be too burdensome and actually make
the code more difficult to read (as you point out). I think it could be
useful for things defined in other modules.

I think you raise valid points, and I generally agree with the comment
from Darius.

For the first pass, I am only thinking about adding type hints to the
public API surface. That includes all public methods and attributes
(only when mypy can't infer them automatically). In reality, I also
need to add type hints to _some_ non-public attributes. I intend to do
this only in cases where mypy can't infer the type and are used from
the public API.

If and when we decide to add type hints to other parts as well, we can
also revisit this discussion. In general, I would favor an incremental
approach.

In case anyone's interested, I have a created a WIP merge request for
adding mypy at:
https://gitlab.com/BuildStream/buildstream/merge_requests/1459

Cheers,
Chandan


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]