-
Notifications
You must be signed in to change notification settings - Fork 199
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
NamedTuples not being documented properly #669
Comments
I took a look at using sphinx-toolbox to autodoc the namedtuples, but I wasn't able to resolve the duplicate fields showing up. It seems that this is a known issue according to here, not too sure how else to go about fixing this. I think it's possible to remove the duplicate 'Alias for field ___' but the issue is combining the type with the docstring |
Thanks for looking into it @amosyou . Eliminating the "Alias for field ___" would already be better, even if we loose the type information IMO. Could you post a screenshot of how that would look like? |
I think that looks good! (module some formatting issues that I thin are orthogonal to this issue). Could you submit a pull request for this? You're on 🔥 @amosyou ! |
revisiting this! so removing :members: from the autoclass directives isn't a viable solution since it also removes fields that are accurately documented like for LookaheadState i've tried using the autodoc-skip-member event as suggested here but it doesn't seem to be removing the duplicate alias fields. i've also tried modifying the _monkey_patch_doc_strings in conf.py to replace lines with "Alias for field number" with empty string, also didn't work. not sure where to go from here 😅 |
Thank you @amosyou for looking into this!
|
@vroulet taht solutions looks great to me! |
Ok, but I may have missed something, @amosyou can you try again on your side and see if that works? Your idea of removing the :members: sounded great :). I let you see if you want to open a PR to remove the :members: and (if you are extra brave) adding the types. |
Strange. All states are missing in that screenshot (they're in pink not in blue). There may be another issue?
So really just removing the line :members: below LookaheadState |
my bad! commenting in rst is not with # that was why they were missing 🤥 on a side note, I think to have proper rendering of the docstring we need to change Fields to Attributes (even though we're working with namedtuples here since we're using autoclass). hope that's fine? i'll create a PR for this. thanks @vroulet! |
Yes, typically, MultiStepsState should be reformatted with attributes instead of fields. Thanks again for looking into that! |
also for ApplyIfFiniteState, I noticed that all the fields are typed as Any. Did we figure out a solution for the typing jnp.array? |
They should be |
PS: no need to add types for all attributes (it's possible but it would take forever). Simply remove the :members: in the doc. If people want to know the types, they should be able to click on [source] in the doc. |
Note the redundancy and all the "Alias for field number X" in classes such as optax.MultiStepsState: https://optax.readthedocs.io/en/latest/api/optimizer_wrappers.html#optax.MultiStepsState
The text was updated successfully, but these errors were encountered: