plotly / plotly/dash

propTypes.exact description not being created on docstrings in specific cases

Open
#1,790 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

Describe your context
Please provide us your environment, so we can easily reproduce the issue.

  • replace the result of pip list | grep dash below
dash                            2.0.0     
dash-design-kit                 1.6.4  
dash-pro-components             0.0.6   

Describe the bug

When creating a new Dash component, some of propTypes comments are not beeing passed to the component docstrings.
For example, the pro.FlowChart component contains the elements definitions with an array of two exact elements, as shown in the screenshots.
Each one of these exact elements have their own description (e.g: Nodes definitions).
These descriptions are ignored when docstrings are auto-generated even though they are in the metadata.json.

nodes_proptypes

Proptypes example mapped to metadata.json
elements_example

Looking at _py_components_generation.py, where the py docstrings are beeing generated, we have this function that maps the exact | shape propTypes

shape_or_exact

This function seems to be ignoring the case that there is a description for the first level of an exact | shape since it iterates through and enters the dictionary levels from the value keys, so never "creates a doc" to the first level description, which is the case of an array of exacts | shapes with a description for each array element

Expected behavior
The expected behavior is that the comments like "Nodes definitions" should be passed to the component docstring.
expected

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading dash/development/_py_components_generation.py around line 494, especially the function that maps exact and shape propTypes. Compare its handling of the metadata.json example with the generated component docstrings; done means descriptions such as “Nodes definitions” appear in the relevant docstrings.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.