>>>> Hi!
>>>>
>>>> I'm using Sphinx's autodoc feature to document my API. For example::
>>>>
>>>>    DEFAULT_OPTION = 'default'
>>>>    def do_something(msg, option=DEFAULT_OPTION):
>>>>        print msg
>>>>
>>>> The generated documentation now shows the following signature:
>>>>
>>>>    do_something(msg, option='default')
>>>>
>>>> How can I tell Sphinx to keep the name of the constant value?
>>>
>>> Most likely you can't.  Python evaluates "DEFAULT_OPTION" during
>>> import, thus the constant is long gone when Sphinx looks at the
>>> *imported* module to extract documentation from it.
>>>
>>>> If at all possible, I'd like NOT to write all signature by hand again.
>>>
>>> Seems to be the only way.
>>
>> I feared as much. Thanks for the info though.
>
> You may want to report this as issue to the Sphinx issue tracker.
> Iirc Sphinx parses the source code itself, too, to extract
> documentation for simple module and class attributes.  This could
> probably be used to use the original function signatures, too, so the
> Sphinx devs can probably easily add this feature.

Bug report can be found here:
https://bitbucket.org/birkenfeld/sphinx/issue/759/keeping-original-signatures-for-functions

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to