0

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
bad_coder
  • 11,289
  • 20
  • 44
  • 72
  • 2
    Did you install [decorator](https://pypi.org/project/decorator/) locally? Next did you specify decorator either as a dependency in your package or in your RTD `requirements.txt`? RTD does not install it according to your [most recent build log](https://readthedocs.org/projects/udsoncan/builds/7166329/). – Steve Piercy May 10 '18 at 06:53
  • I do have the decorator module locally, but I don't recall installing it, I assumed it was part of Python standard package. I did add it to the requirements.txt file and it fixed the issue! Many thanks – Pier-Yves Lessard May 10 '18 at 16:21
  • I converted my comment to an answer below. Please accept it as the solution. Thank you! – Steve Piercy May 11 '18 at 06:09
  • If the answer solved your problem please don't forget to also upvote it. – bad_coder Apr 18 '21 at 00:21

2 Answers2

0

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.

Sraw
  • 18,892
  • 11
  • 54
  • 87
  • I am locally using Sphinx = 1.3.6. I've tried forcing the version in my requirement file, but that didn't do it. I have presently 2 requirement : sphinx_rtd_theme>=0.3.1 sphinx==1.3.6 – Pier-Yves Lessard May 10 '18 at 01:36
  • You need to specify the location of `requirements.txt` in project settings. – Sraw May 10 '18 at 01:37
  • Yes yes, I did. It is considered during the build. I set sphinx_rtd_theme previously to fix another issue (https://github.com/rtfd/sphinx_rtd_theme/issues/633#issuecomment-387335427) and it worked, so this part seems fine. – Pier-Yves Lessard May 10 '18 at 01:38
0

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.

Steve Piercy
  • 13,693
  • 1
  • 44
  • 57