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

[Doc] Style of parameter tables in API reference is being broken #1555

Closed
i-aki-y opened this issue Mar 2, 2024 · 8 comments
Closed

[Doc] Style of parameter tables in API reference is being broken #1555

i-aki-y opened this issue Mar 2, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@i-aki-y
Copy link
Contributor

i-aki-y commented Mar 2, 2024

📚 Documentation

The style of the parameter tables in the API documentation is being broken.
https://albumentations.ai/docs/api_reference/augmentations/transforms/

api-doc

I found recent commit inserts ------ in the docstrings:

    Args:
+    ----
	para1: ...
	para2: ...

This appears to prevent mkdocs from parsing the docstring, since mkdocs assumes "google-style" that does not use ----- for sections.

https://github.com/albumentations-team/albumentations.ai/blob/4fda83887b102ea3f0e08c9f10e5ea7d4dfd4201/mkdocs/src/mkdocs.yml#L13-L14

cf: about google-style
https://mkdocstrings.github.io/python/usage/docstrings/google/
https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html

@ternaus
Copy link
Collaborator

ternaus commented Mar 2, 2024

Thanks for pointing this out.

@ternaus ternaus added the bug Something isn't working label Mar 2, 2024
@ternaus
Copy link
Collaborator

ternaus commented Mar 2, 2024

FIxed in #1556

The issue was that script that generated docs did not distinguish between Deprecated class and deprecated parameter in the class and did not use it.

@ternaus ternaus closed this as completed Mar 2, 2024
@i-aki-y
Copy link
Contributor Author

i-aki-y commented Mar 3, 2024

@ternaus Thank you for your quick response.

But I could not confirm the fix in the documetation site.

Lines "----" appear in commit #1529, where the lines are inserted at some sections (not all sections) of every transform's docstrings.
I think we need to remove those inserted lines “----" to fix the issue.

@ternaus ternaus reopened this Mar 3, 2024
@ternaus
Copy link
Collaborator

ternaus commented Mar 3, 2024

I was not able to set up ruff to check for "----", it does not flag it as violation of google docstrings format.

I will try to upgrade version of mkdocs, maybe it will be more robust toward formatting of the docstring.

I can also have a custom hook, that just look for "---" and longer in the code.

What exactly don't you like in the existing version of parsed docstrings?

@i-aki-y
Copy link
Contributor Author

i-aki-y commented Mar 4, 2024

The current albumentation dosctring mixes two docstring section styles (google and numpy).
The mkdocs support two of them but can not handle mixed cases in a single project.
I found the following issue discussing more flexible style support in the mkdocs, but the issue is still open and is inconclusive.

mkdocstrings/griffe#5

It would be preferable to format docstring with tools like ruff or black, but currently, they do not seem able to handle docstring styles.
And I could not find other tools that support formatting multiple docstring styles.

If possible, I think writing a custom hook would be a practical workaround, and I expect deleting "---" is sufficient.
I could confirm that the mkdocs correctly rendered the parameter table by deleting lines "----" in a transform docstring on my local machine.

Ex:
screenshot_params

@ternaus
Copy link
Collaborator

ternaus commented Mar 4, 2024

Added check for --- in docstrings and cleaned from the existing code. It is a hack, rather than solution, but hopefully will help for some time: #1558

@ternaus
Copy link
Collaborator

ternaus commented Mar 4, 2024

Looks like works

@ternaus ternaus closed this as completed Mar 4, 2024
@i-aki-y
Copy link
Contributor Author

i-aki-y commented Mar 5, 2024

@ternaus Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants