question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The @ray.remote decorator breaks Sphinx autoclass extension.

See original GitHub issue

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Mac OS X 10.13.5
  • Ray installed from (source or binary): both
  • Ray version: 0.5.0
  • Python version: Python 2.7.10
  • Exact command to reproduce: See below.

Describe the problem

Ray decorators breaks Sphinx autoclass extension.

If a class is decorated and documented using docstrings, documentation is not generated. The MyClass class can still be imported by Sphinx.

@ray.remote(num_gpus=1)
class MyClass(object):
    """ lorum ipsum """

...

I use the Sphinx extension sphinx.ext.autodoc to build my documentation.

See also Civilize your Python @decorators

Source code / logs

To reproduce this issue, run the following inside a virtualenv or similar:

git clone git@github.com:martisak/ray_decorator_issue.git 
pip install -r requirements.txt
make html

Then open build/html/index.html in your favorite browser, which should look like the following.

screenshot

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
simon-mocommented, Jun 21, 2019

some combination of wraps and overriding __doc__, __signature__ should do it.

0reactions
sofietorfscommented, Apr 29, 2020

I’m using ray version 0.8.2 and python version 3.6.9 and I am experiencing the same problem. I’m quite new to python and sphinx, so I don’t understand the solution. Would it be possible for someone to explain it for me?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to extend Sphinx automodule to domains ...
The answer to my own question is: yes. I've managed to do it, but it wasn't easy and the results are far from...
Read more >
sphinx.ext.autodoc – Include documentation from docstrings
This extension can import the modules you are documenting, and pull in documentation from docstrings in a semi-automatic way. ... For Sphinx (actually,...
Read more >
sphinx-all command man page - python3 ...
In order to use autodoc, you need to activate it in conf.py by putting the string 'sphinx.ext.autodoc' into the list assigned to the...
Read more >
decorators — sphinx-toolbox 3.2.0 documentation
Called after parsing title and target text, and creating the reference node (given in refnode ). This method can alter the reference node...
Read more >
Proceedings of the 7th Python in Science conference
we don't needlessly break backward compatibility. ... Sphinx-based documentation — This summer saw ... automodule:: matplotlib.pyplot.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found