-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
autodoc_member_order ignored #13
Comments
Huh, that definitely sounds like a bug. Off the top of my head I can't think why this would be happening, either, since async and sync methods mostly get handled by the same code paths... Well, actually, one thing to check is how Sphinx is even finding out the "source order" in the first place. If it's, like, running a regex over the source, and that regex is looking for |
Hello, thanks for the fast answer. |
So this still sounds like something that needs fixing :-). Do you think it needs to be fixed in sphinx, then? Is there a bug open with them? Maybe it's something that sphinxcontrib-trio could work around in the mean time? |
Well I do not have much time to spend on this and did not want to waste yours. The code that does the sorting is in sphinx autodoc extension, in this file. It uses the The parsing is done by the And at last, All of this happens in sphinx, I do not know what hooks are available or if it's possible (or even desirable to monkey patch stuff). Probably an issue there… … and yes, there is an awaiting PR here: sphinx-doc/sphinx#4847 |
I am also suffering this issue. So without waiting, we have nothing to do? |
@Sraw Not necessarily... judging from that PR, it might be as simple as adding a monkey-patch to from sphinx.pycode.parser import VariableCommentPicker
if not hasattr(VariableCommentPicker, "visit_AsyncFunctionDef"):
VariableCommentPicker.visit_AsyncFunctionDef = VariableCommentPicker.visit_FunctionDef Looking at |
Let's say, if I add the snippet you give to Let me have a test... |
No, it only works as dreamed... I think maybe I should find a way to mock this class globally. |
Huh, that's weird. That snippet does patch the class globally, and it looks like it should work... |
Ops, I delete |
That's a great workaround indeed. |
Anyone want to submit a PR to add this workaround to sphinxcontrib-trio itself, so people can get the benefit without tracking down this issue? |
I will, in hours. |
Fixed by #14 |
I just realized that we never actually made a release after fixing this. So for anyone who's been waiting... sphinxcontrib-trio v1.0.2 is out now, with the fix. |
Hello,
I am trying to get sphinx to handle async methods in my project. I had good results with
sphinxcontrib-trio
so far, but I cannot achieve the member ordering I want.My sphinx configuration has
autodoc_member_order = 'bysource'
defined.The directive seems not to be applied to asynchronous functions. I end up with class members ordered this way:
Expected result:
All members together, in source order.
Help most welcome.
The text was updated successfully, but these errors were encountered: