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

Adding docstring to interactive #822

Merged
merged 3 commits into from
Aug 10, 2022
Merged

Adding docstring to interactive #822

merged 3 commits into from
Aug 10, 2022

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Aug 5, 2022

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

MarcSkovMadsen commented Aug 5, 2022

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.

@@ -365,6 +365,22 @@ def get_ax():
return get_ax

def __call__(self, *args, **kwargs):
"""
Copy link
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
Copy link
Member

maximlt commented Aug 10, 2022

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.

None yet

3 participants