pytkdocs icon indicating copy to clipboard operation
pytkdocs copied to clipboard

Return members in the same given order

Open pawamoy opened this issue 4 years ago • 6 comments

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).

pawamoy avatar May 01 '20 10:05 pawamoy

Hello again! Has this been fixed/implemented?

ofek avatar Jan 25 '21 22:01 ofek

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 avatar Sep 21 '21 19:09 pawamoy

@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 avatar Nov 24 '21 04:11 ofek

@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.

pawamoy avatar Dec 14 '21 17:12 pawamoy

This should now be fixed (finally :hot_face:!), at least with the new Python handler.

pawamoy avatar May 28 '22 16:05 pawamoy

Ah, but we're in the pytkdocs repo here :facepalm: So it's not fixed. But it can now be fixed. Reopening.

pawamoy avatar May 28 '22 16:05 pawamoy