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

Keep doc-string order for shape or exact props #2994

Merged
merged 7 commits into from
Sep 18, 2024
Merged

Conversation

CNFeffery
Copy link
Contributor

In developing custom components, parameters defined by PropTypes.shape or PropTypes.exact should ensure that the automatically generated doc-string follows the original order in the source code.

Closes #2990

@gvwilson gvwilson added feature something new P3 backlog community community contribution labels Sep 11, 2024
Copy link
Contributor

@T4rk1n T4rk1n left a comment

Choose a reason for hiding this comment

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

Looks good, just a couple comments and missing a changelog entry.

@T4rk1n
Copy link
Contributor

T4rk1n commented Sep 16, 2024

There is failure in unit test that check for hardcoded values that needs to be updated:

    5 failed
     - tests/unit/development/test_generate_class.py:105 test_docstring
     - tests/unit/development/test_generate_class_file.py:64 test_class_string
     - tests/unit/development/test_generate_class_file.py:73 test_class_file
     - tests/unit/development/test_metadata_conversions.py:77 test_docstring
     - tests/unit/development/test_metadata_conversions.py:87 test_docgen_to_python_args

For the first three. just need to copy the new generated content and paste it on: https://github.com/plotly/dash/blob/2ec3f5ccc6b0869f41bf6919994a08f7c24332b6/tests/unit/development/metadata_test.py

metadata_conversion can change the order of the docstrings:

"optionalObjectWithExactAndNestedDescription",
"\n".join(
[
"dict with keys:\n",
" - color (string; optional)\n",
" - figure (dict; optional):",
" Figure is a plotly graph object.\n",
" `figure` is a dict with keys:\n",
# noqa: E501
" - data (list of dicts; optional):",
" data is a collection of traces.\n",
" - layout (dict; optional):",
" layout describes the rest of the figure.\n",
# noqa: E501
" - fontSize (number; optional)",
]
),
],
[
"optionalObjectWithShapeAndNestedDescription",
"\n".join(
[
"dict with keys:\n",
" - color (string; optional)\n",
" - figure (dict; optional):",
" Figure is a plotly graph object.\n",
" `figure` is a dict with keys:\n",
# noqa: E501
" - data (list of dicts; optional):",
" data is a collection of traces.\n",
" - layout (dict; optional):",
" layout describes the rest of the figure.\n",
# noqa: E501
" - fontSize (number; optional)",
],
),
],

Copy link
Contributor

@T4rk1n T4rk1n left a comment

Choose a reason for hiding this comment

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

💃 Looks good, thank you.

@T4rk1n T4rk1n merged commit 288652c into plotly:dev Sep 18, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community community contribution feature something new P3 backlog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

generated content of parameter comments for oneOfType is confusing
3 participants