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

improve Python docstrings #421

Open
alexcjohnson opened this issue Nov 17, 2024 · 3 comments · Fixed by plotly/dash#3080
Open

improve Python docstrings #421

alexcjohnson opened this issue Nov 17, 2024 · 3 comments · Fixed by plotly/dash#3080
Labels
good first issue Good for newcomers

Comments

@alexcjohnson
Copy link
Collaborator

The DMC components have top-level descriptions that are just their names, for example:

/** Accordion */
const Accordion = (props: Props) => {

The result in codegen is broken :

class Accordion(Component):
    """An Accordion component.
ordion

Keyword arguments:
...

I suspect because we're expecting a multiline description here, and in a multiline docstring the first three characters are *, eg dcc.CheckList:

/**
 * Checklist is a component that encapsulates several checkboxes.
 * The values and labels of the checklist are specified in the `options`
 * property and the checked items are specified with the `value` property.
 * Each checkbox is rendered as an input with a surrounding label.
 */
export default class Checklist extends Component {

We should fix this on the component generation side (I'll make an issue, or maybe just a PR if it's simple), but wanted to flag it here because (a) this is where I saw it, and (b) perhaps it would be good to improve the DMC docstrings, giving each component more than just its name as a top-level description?

@AnnMarieW
Copy link
Collaborator

Nice update! This will be helpful for everyone making custom Dash components 🙂

@alexcjohnson
Copy link
Collaborator Author

Ha, didn't realize you could have a PR in a whole different org close an issue... anyway I guess it makes sense to close with my PR since it'll no longer be malformed. I do think having a one-sentence description on each component would be nice, so that in an IDE someone reading the code gets a little more context on what a given component is for. Plus as is it'll be redundant because Dash starts the docstring with "A(n) {component_name} component", then DMC components have the name again on the next line.

@AnnMarieW
Copy link
Collaborator

I do think having a one-sentence description on each component would be nice, so that in an IDE someone reading the code gets a little more context on what a given component is for. Plus as is it'll be redundant because Dash starts the docstring with "A(n) {component_name} component", then DMC components have the name again on the next line.

I agree! I just reopened this issue :-)

For anyone reading this thread -- this is a great first issue to work on, especially if you’re new to contributing to open source. You don’t need any React knowledge, so it’s an easy way to get familiar with the structure of this library and see how the development process works. I’m happy to help mentor anyone interested in making a PR!

@AnnMarieW AnnMarieW reopened this Nov 18, 2024
@AnnMarieW AnnMarieW changed the title [bug] malformed Python docstrings improve Python docstrings Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants