Skip to content

Adding docstring to interactive#822

Merged
maximlt merged 3 commits into
masterfrom
docstring_interactive
Aug 10, 2022
Merged

Adding docstring to interactive#822
maximlt merged 3 commits into
masterfrom
docstring_interactive

Conversation

@hoxbro

@hoxbro hoxbro commented Aug 5, 2022

Copy link
Copy Markdown
Member

An attempt at adding the docstring for interactive. I have kept the class docstring in the code, but because it is heavily developer-focused, I have removed it when using ? in a notebook.

1

@MarcSkovMadsen

MarcSkovMadsen commented Aug 5, 2022

Copy link
Copy Markdown
Collaborator

When I have been making these changes I've normally been doing them on the Class because VS Code tooltips use this instead of the __init__ docstring. If I am actively typing the parameters MyClass(name=...) then it uses the __init__ docstring if it exists and falls back to the Class docstring otherwise.

How does your approach work in VS Code @hoxbro ? My guess is that the Class docstring needs to be for users too. And then you can optionally add the __init__ or __call__. But all of them should be targetted users as they will see and need them at different times.

Comment thread hvplot/interactive.py
return get_ax

def __call__(self, *args, **kwargs):
"""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment in post about whether the docstring should be on the Class, __init__ or __call__ level.

@maximlt

maximlt commented Aug 10, 2022

Copy link
Copy Markdown
Member

Thanks a lot @hoxbro , I've just re-arranged the docstrings, which mostly consisted in moving the How it works section out of the Interactive docstrings. Both the Interactive class and its __call__ method have a docstring, so that it will appear in an IDE like VSCode in both situations.

@maximlt maximlt merged commit 8077a62 into master Aug 10, 2022
@maximlt maximlt deleted the docstring_interactive branch August 10, 2022 23:38
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

Successfully merging this pull request may close these issues.

3 participants