Python Sphinx autodoc and decorated members

I had the same problem with the celery @task decorator. You can also fix this in your case by adding the correct function signature to your rst file, like this: .. autoclass:: Bus :members: .. automethod:: open(self) .. automethod:: some_other_method(self, param1, param2) It will still document the non-decorator members automatically. This is mentioned in the … Read more

Sphinx Autodoc skip member from docstring

You can now (as of version 0.6) use :exclude-members: to exclude specific members from the documentation: The directives supporting member documentation also have a exclude-members option that can be used to exclude single member names from documentation, if all members are to be documented. New in version 0.6. Source: http://www.sphinx-doc.org/en/stable/ext/autodoc.html In your specific case, you … Read more

Sphinx: how to exclude imports in automodule?

There is no way to tell Sphinx to exclude some imports. When using autodoc, all documented modules must be cleanly importable. You might be able to work around the problem by doing some mocking. Here is an article describing the solution to a problem that seems quite similar to yours: http://blog.rtwilson.com/how-to-make-your-sphinx-documentation-compile-with-readthedocs-when-youre-using-numpy-and-scipy/. Here is a small … Read more

Documenting class attributes with type annotations

I do not think you can put an Attribute section inside of your docstring to get your desired results. I tried giving each attribute a doc comment and specified the type and desired comment. class DataHolder: “”” Class to hold some data Each attribute needs its own doc comment with its type “”” #: bool: … Read more

How would I cross-reference a function generated by autodoc in Sphinx?

You don’t need to add labels. In order to refer to a Python class, method, or other documented object, use the markup provided by the Python domain. For example, the following defines a cross-reference to the mymethod method: :py:meth:`mymodule.MyClass.mymethod` Or even simpler (since the Python domain is the default): :meth:`mymodule.MyClass.mymethod` The documentation of TextWrapper.wrap that … Read more

Sphinx error: Unknown directive type “automodule” or “autoclass”

The same thing happened to me! To fix it, go to the line in conf.py that says something like this: extensions = [‘sphinx.ext.todo’, ‘sphinx.ext.viewcode’] Yours will probably look different. Anyway, add ‘sphinx.ext.autodoc’ to the list. e.g. extensions = [‘sphinx.ext.todo’, ‘sphinx.ext.viewcode’, ‘sphinx.ext.autodoc’] If it was: extensions = [] then you’d change it to: extensions = [‘sphinx.ext.autodoc’] … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)