简体   繁体   中英

Sphinx autodoc - decorator and ReadTheDocs

I am having a little trouble with Sphinx auto-generated documentation with autodoc. I basically have the same issue as here : Python Sphinx autodoc and decorated members

When I used a decorator on a function, the signature shown in the documentation was the signature of the decorator. Following the intruction of the above thread, I put the @decorator decorator on my decorator definition, and it did solve the issue.

Now I've hooked my project to ReadTheDoc.org which works pretty well, the only things is that the decorator issue came back regadless of the revious fix.

I am quite new to Sphinx, so I am not sure if that is worth generating an issue on the RTD Github project. What can I be missing here? See a broken signature here

Could it be a configuration? I build the doc with Python3

Also, I have defined a dummy @decorator if the module is not available, like so:

try:
    from decorator import decorator
except ImportError:
    def decorator(f):
        return f

You can add a requirements.txt file in RTD, and in that file, you can specify exactly the same environment as your local's.

Surely including sphinx as RTD uses sphinx==1.6.5 . That version may have different behave from yours.

According to your recent build log on RTD , decorator was not installed on RTD.

You must either specify decorator as a dependency in your package or add it to your RTD requirements file requirements.txt .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM