Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type hints #84

Open
amaloney opened this issue Aug 16, 2024 · 1 comment
Open

type hints #84

amaloney opened this issue Aug 16, 2024 · 1 comment

Comments

@amaloney
Copy link

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

def plot_forest(
dt,
var_names=None,
filter_vars=None,
group="posterior",
coords=None,
sample_dims=None,
combined=False,
point_estimate=None,
ci_kind=None,
ci_probs=None,
labels=None,
shade_label=None,
plot_collection=None,
backend=None,
labeller=None,
aes_map=None,
plot_kwargs=None,
stats_kwargs=None,
pc_kwargs=None,
):

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants