pytkdocs
pytkdocs copied to clipboard
Return members in the same given order
Is your feature request related to a problem? Please describe. Feature asked in mkdocstrings: https://github.com/pawamoy/mkdocstrings/issues/102#issuecomment-622204877
Describe the solution you'd like
- pytkdocs should re-order the root object children using the given members order.
- For this we'll need to stop casting members as a set, and keep it as a list.
- Before returning the root object, we'll then need to re-order them.
- Let's make it the default, not configurable behavior (sorting is more a rendering issue, we shouldn't implement rendering configuration in pytkdocs)
Describe alternatives you've considered
It's easier to do it in pytkdocs than re-sorting in mkdocstrings: the renderer and collector options are separated, it would be messy to use the collector options in the renderer, and I don't want to duplicate the members
option in the renderer (nor users want to copy/paste it).
Hello again! Has this been fixed/implemented?
8 months later...
No :confused: PRs welcome. I'm currently reducing the number of open issues to keep the ones we could still implement/fix in pytkdocs (which will be replaced by a more robust tool).
@pawamoy Hmm, I see your preferred solution 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 https://github.com/mkdocstrings/mkdocstrings/pull/274
@ofek sorry for the late reply :bow:
have the renderer read the members and act accordingly
Unfortunately that is not possible, because mkdocstrings passes the selection options only to the collector, not the renderer. I wouldn't be against a refactor that removes the distinction between these two options groups (no more selection/rendering keys, no more base renderer / base collector classes, just a base handler one that receives all options). Up to the discussion of course.
I'll try to come up with a workaround in the next few days (keeping that issue in my saved notifications).
Also note that I've been working on a new "collector" which might alleviate this issue. I'll try to move forward on this in the next few days as well.
This should now be fixed (finally :hot_face:!), at least with the new Python handler.
Ah, but we're in the pytkdocs repo here :facepalm: So it's not fixed. But it can now be fixed. Reopening.