dash icon indicating copy to clipboard operation
dash copied to clipboard

Fixing poor docstring formatting for @callback

Open woefulpines opened this issue 1 year ago • 8 comments

It seems like some reStructuredText elements don't render well in vscodes docstring preview window #2670. I replaced feature lists with elements that were supported according to this example in pandas contributing guidelines. In terms of content, nothing is added or changed, just formatted it differently.

  • [X] I have broken down my PR scope into the following TODO tasks
    • [X] Set up local repo according to contributing guidelines.
    • [X] Figure out why the doc string was not formatting properly.
    • [X] Replace problematic reStructure elements with more agreeable elements.
    • [X] Conform additions to code style, eliminating linter errors.

woefulpines avatar Jan 21 '24 02:01 woefulpines

Thank you for this PR, @woefulpines . We appreciate the time you put into this.

Coding-with-Adam avatar Jan 22 '24 21:01 Coding-with-Adam

Thanks @woefulpines! The main thing I'm concerned about here is how it works with the dash docs reference pages: https://dash.plotly.com/reference#dash.callback is auto-generated from this docstring. Frankly I'd prefer to move away from reStructuredText entirely, in favor of something more human-centered, perhaps looking more like component docstrings (which are themselves autogenerated). FYI @LiamConnors

alexcjohnson avatar Jan 24 '24 20:01 alexcjohnson

Out of curiosity, how do you generate your documentation? Is there some resource that talks about it?

woefulpines avatar Jan 26 '24 23:01 woefulpines

Also I realized now that dash/dash.py has an example of feature lists working in the vscode doc popup window so I can try that for the time being and have some changes that may be more inline with your standards.

woefulpines avatar Jan 26 '24 23:01 woefulpines

Unfortunately our docs repo is private, just because we use our enterprise packages in it. But we’ve been discussing some ways to potentially open it up, which would make this kind of thing a lot easier!

alexcjohnson avatar Jan 27 '24 04:01 alexcjohnson

I added feature lists back in. I wasn't able to use blank lines to format the docstring, I hope newlines wont give the document generator any trouble. Looking at dash/dash.py. The comment for the dash class is allowed to use blank lines and it also has type annotations in the docstring for each parameter. So if those were things you would like in the callback docstring, I can add them in. Thank for your patience with this. I really appreciate it.

woefulpines avatar Jan 28 '24 03:01 woefulpines

Yeah the formatting here does break it in the Dash docs image Checking to see what part might be breaking it

LiamConnors avatar Jan 29 '24 15:01 LiamConnors