You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Respect the order of selection.members when displaying the attributes/methods of a class.
Describe the solution you'd like
Ordering the sections of a class according to how they were listed under selection.members.
Describe alternatives you've considered
A new option can be introduced that deals specifically with sorting, but I feel that introduces one more thing to maintain.
Another option would be to sort the methods in the same order as they were defined in the class, though I can see this becoming an issue for folks that want to sort their methods in the code in one way and their docs in another.
Additional context
Assuming there is a class with the methods add, subtract, multiply, and divide, the docs currently list them in alphabetical order.
I would like to manually specify an order, maybe something like so:
I think it would be fair to respect the specified members order, though I'd like to have the opinion of others using this feature 🙂 @ofek@florimondmanca@StephenBrown2@chrieke (from #44)
Additionally, a sorting option would be nice. Sphinx has that: source order, alphabetical order, and group order IIRC?
@pawamoy Hmm, I see your preferred solution in mkdocstrings/pytkdocs#29 but wouldn't it make more sense to have the renderer read the members and act accordingly? Especially since the renderer has since added a new sorting option #274
This is marked as closed, but as far as I can tell, the original request (which is what I need) to respect the order of members is still not supported - the only options are alphabetical and source - as per here.
Is there any possibility to re-open this and provide a way to respect the order from member?
The members_order option is ignored when a list of members is specified, however the group_by_category one still comes into play (and it is on by default). Maybe try to set it to false to see if the order is better? We can consider ignoring this option as well when members are specified.
Activity
pawamoy commentedon Apr 27, 2020
I think it would be fair to respect the specified members order, though I'd like to have the opinion of others using this feature 🙂 @ofek @florimondmanca @StephenBrown2 @chrieke (from #44)
Additionally, a
sortingoption would be nice. Sphinx has that: source order, alphabetical order, and group order IIRC?ofek commentedon Apr 27, 2020
Yes please! The natural order of
membersshould be the default.StephenBrown2 commentedon Apr 27, 2020
Just a note, Sphinx sorts the members by default. TIL that that's configurable!
ofek commentedon May 1, 2020
I'll take any way we choose 🙂
pawamoy commentedon May 1, 2020
Let's do this then. Just opened mkdocstrings/pytkdocs#29
feat: Add a rendering option to change the sorting of members
ofek commentedon Nov 24, 2021
@pawamoy Hmm, I see your preferred solution in mkdocstrings/pytkdocs#29 but wouldn't it make more sense to have the renderer read the members and act accordingly? Especially since the renderer has since added a new sorting option #274
pawamoy commentedon Dec 14, 2021
See my answer here: mkdocstrings/pytkdocs#29 (comment)
pawamoy commentedon May 28, 2022
Fixed in the new handler (not the legacy one, though it's possible to fix now).
samuelcolvin commentedon Jul 20, 2023
This is marked as closed, but as far as I can tell, the original request (which is what I need) to respect the order of
membersis still not supported - the only options arealphabeticalandsource- as per here.Is there any possibility to re-open this and provide a way to respect the order from
member?pawamoy commentedon Jul 20, 2023
The
members_orderoption is ignored when a list of members is specified, however thegroup_by_categoryone still comes into play (and it is on by default). Maybe try to set it to false to see if the order is better? We can consider ignoring this option as well when members are specified.