arviz-devs / arviz-plots

ArviZ modular plotting
https://arviz-plots.readthedocs.io
Apache License 2.0
2 stars 1 forks source link

type hints #84

Open amaloney opened 4 weeks ago

amaloney commented 4 weeks ago

I'd like to add type hints to the inputs of the plotting modules, for example.

https://github.com/arviz-devs/arviz-plots/blob/a1e32a5dc565ec4ffad317ee106cf9f1f3592bda/src/arviz_plots/plots/forestplot.py#L16-L36

The docstrings are very well documented, but it would be nice to let your editor know what each argument is expecting so you can get immediate feedback about a type, instead of the Unknown. For example

image

@OriolAbril you can assign to me if this addition is okay

OriolAbril commented 4 weeks ago

I am very bad with type hints and haven't had very good experience with them so far but I do always try to document things as well as possible, and I am also not opposed to them. I was hoping for https://github.com/scientific-python/docstub to advance a bit more and then be able to get the type hints from the docstring so we don't have to duplicate information.

I definitely agree about having type hints, but given the limited development and maintenance capacity we have right now (and the lack of grants/sponsors in sight that could change this) I'll want to make sure it doesn't add extra work. i.e. we had mypy running on arviz at some point, using https://github.com/obi1kenobi/typing_copilot in order to add type hints progressively, but we ended up removing it due to the inconsistency of the results even though we had help from typing_copilot's maintainer.