Hi,

If you'd like to sort members by definition order, it would be better
to follow PEP-520. Since py36, using cls.__dict__ is much appropriate
way to sort members "by source" instead of analyzer.
https://www.python.org/dev/peps/pep-0520/

Thanks,
Takeshi KOMIYA

2020年2月18日(火) 3:15 'Mmanu Chaturvedi' via sphinx-users
<[email protected]>:
>
> Hi Takeshi Komiya,
>
> Thanks for the reply!
>
> > Is this resolved if we'll add an option for sorting methods by
> > definition order (in source code)?
>
> Yes, that could possibly resolve the issue.  We seem to have the `bysource` 
> option, which seems to be for sorting by source, but it doesn't work for us.
> The `self.analyzer` gets set to `None`:
>
> https://github.com/sphinx-doc/sphinx/blob/af62fa61e6cbd88d0798963211e73e5ba0d55e6d/sphinx/ext/autodoc/__init__.py#L674
>
> Also, there seem to be open issues related to `bysource`:
> https://github.com/sphinx-doc/sphinx/issues/3673
>
> Thank you,
> Mmanu
>
> On Sunday, February 9, 2020 at 8:31:24 AM UTC-5, Komiya Takeshi wrote:
>>
>> Hi,
>>
>> Is this resolved if we'll add an option for sorting methods by
>> definition order (in source code)?
>> We have an issue to add such option. I'd like to know it helps your case or 
>> not.
>>
>> Thanks,
>> Takeshi KOMIYA
>>
>> 2020年2月6日(木) 13:58 'Mmanu Chaturvedi' via sphinx-users
>> <[email protected]>:
>> >
>> > Hi,
>> >
>> > Consider the following problem:
>> >
>> > Suppose we have three methods bound to a class `C` with the following 
>> > names:
>> > `__init__`, `a` and `A`.
>> >
>> > Now, in the documentation created by sphinx, we'd have documentation in 
>> > order (when `member-order` is `alphabetic`) :
>> > `A`, `__init__` and `a`.
>> >
>> > it seems like it is so because:  `sorted(["a", "__init__", "A"]) == ["A", 
>> > "__init__", "a"]`
>> > https://github.com/sphinx-doc/sphinx/blob/master/sphinx/ext/autodoc/__init__.py#L501-L506
>> >
>> > -------
>> >
>> > I know that it's not recommended by PEP8, but we have a few methods which 
>> > start with a capital letter. ( We're creating python bindings via 
>> > pybind11).
>> >
>> > This behavior of sphinx, is leading to documentation which looks unsightly 
>> > because sometimes `__init__` comes way down after all the methods which 
>> > start with a capital letter:
>> > https://www.photobox.co.uk/my/photo/full?photo_id=502682079763
>> >
>> > I was wondering how could we solve it?
>> >
>> > Thanks,
>> > Mmanu
>> >
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "sphinx-users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an 
>> > email to [email protected].
>> > To view this discussion on the web visit 
>> > https://groups.google.com/d/msgid/sphinx-users/abcfbd61-6562-4d65-ae05-a6ff3b5fed1e%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sphinx-users/e7b4e2e6-d401-4b05-a531-5c4bebdb2469%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/CAFmkQAMWNqLq6Woy3EYhMMh1RUGbXJL7v6WimJS1wEw3gD7CHQ%40mail.gmail.com.

Reply via email to