I tried to create a PR, which adds the ability to add a custom key function:

https://github.com/sphinx-doc/sphinx/pull/7177

If you think it's acceptable, I can create a corresponding issue as well.
When the python code is in `.so` format which we import, the analyzer 
doesn't work on it.


On Monday, February 17, 2020 at 1:15:52 PM UTC-5, Mmanu Chaturvedi wrote:
>
> 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/6f82a0cd-f9d7-4f3a-b549-6960acfff918%40googlegroups.com.

Reply via email to