Questions tagged [sphinx-napoleon]

Napoleon is an extension for the Sphinx documentation generator, which adds support for Google and NumPy docstrings.

Napoleon is an extension for the Sphinx documentation generator. It is written by Rob Ruana and is licensed under the 2-clause BSD License.

It allows you to avoid the use of reStructuredText in docstrings, that make them more difficult to read. Instead, it enables support for legible, easy-to-read docstrings by using Google and/or NumPy-style docstrings. To achieve this, Napoleon first processes the docstrings and converts them to reStructuredText. However, reStructuredText will still be available for use while using Napoleon.

Every docstring (on modules, classes, attributes, methods, functions and variables) can be processed with Napoleon.

58 questions
1
vote
1 answer

Create type links to other version of the standard library with Sphinx napoleon

I document a Python project using Sphinx and the Napoleon and the autodoc extension to parse Google style docstrings. As the Google style involves specifying the type of the arguments, Sphinx automatically creates links to the documentation of the…
Jarno
  • 6,243
  • 3
  • 42
  • 57
1
vote
2 answers

sphinx autodoc-skip-member handler: can't show __init__() when using napoleon

I want to include the docstrings for __init__() in my sphinx-generated documentation. I was following the accepted answer to this stackoverflow question to add a handler for autodoc-skip-member and was still unable to see my __init__()…
Scott
  • 1,247
  • 3
  • 10
  • 21
1
vote
1 answer

How can I apply :special-members: to just one class inside an automodule directive?

I am putting together Sphinx-driven (v1.3.1) documentation for a Python 2.7 project using autodoc and napoleon. Inside one module, which I'd like to document with a single automodule:: directive, I have a specific class to which I want to apply the…
hBy2Py
  • 1,707
  • 19
  • 29
0
votes
0 answers

How to create hyperlinks in a sphinx documentation when using type aliases?

I have a function with type annotations using type aliases in Python ExampleArrayLike = Union[list, np.ndarray] def module_level_function_5( array_like: ArrayLike, array: numpy.ndarray ) -> ExampleArrayLike: Sphinx autodoc provides…
0
votes
0 answers

How to make Sphinx understand GFM tables in docstrings

VSCode can't render simple or grid-based reStructured tables in docstrings. It only understands GFM tables. However neither Napoleon nor MyST provide a way to parse them. MyST has a Python API, but I couldn't find out any way to hook a Sphinx event…
0
votes
0 answers

How to use autodoc in sphinx to show docStrings?

How to configure project so it will use Sphinx autodoc to get DocString from python code and show it on html? Its is not clear from the documentation what to add where to make autodoc get all my docStrings. here is my conf.py import os import…
Akshat Tamrakar
  • 2,193
  • 2
  • 13
  • 21
0
votes
1 answer

Sphinx: how to show attributes as in scipy

Let's say we have the following module testmodule.py with a TestClass definition: """This is a test module""" class TestClass: """ This is a simple description. Attributes ---------- egg : int An egg. Should be from a…
Breno
  • 748
  • 8
  • 18
0
votes
1 answer

Napoleon overescapes trailing underscore in parameter name leading to Unknown target name error

I now have exactly the problem that was described in this issue: https://github.com/sphinx-doc/sphinx/issues/7734. An MWE is also provided in that issue. My problem is just that the fix doesn't seem to be activated by default. In the source code I…
0
votes
1 answer

Sphinx autodoc/napoleon doesn't generate docstrings

I'm doing a really simple example and can't get it to work. I just have one file, simulator.py that I added numpy style docstrings to. It does not import any other libraries. It has an __init__ and I can import it from a python interpreter. My…
Katie
  • 21
  • 1
  • 7
0
votes
1 answer

Variable format changed to ~class.attribute in docs

So I've been working on some docs for some weeks now and they always appeared fine until last night all the variables started coming up in the format ~Class.Attribute. I attempted to rollback to multiple previous versions that had been working but…
Sohjiro
  • 23
  • 4
0
votes
1 answer

Text outside parameters section in sphinx

I am writing documentation for my function using napoleon syntax. I would like to have a paragraph after my parameter list in the docs. The docs currently look like this: def x(a): """ A sample function. A sample blurb before. …
Mad Physicist
  • 107,652
  • 25
  • 181
  • 264
0
votes
1 answer

Sphinx 1.4+ and block literals in Returns with sphinx-napoleon don't work anymore

I am writing documentation for a python project that follows this guide: http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html To be exact this part of the guide: The Returns section supports any reStructuredText formatting,…
Drachenfels
  • 3,037
  • 2
  • 32
  • 47
-1
votes
1 answer

How to fix "Unexpected section title"?

This docstring: """ Returns ------- out: int Output. Bad title --------- Text. """ produces: C:\module.py:docstring of my_pkg.module.func:5: CRITICAL: Unexpected section title. Bad title --------- Can I make it respect Bad title, or at…
1 2 3
4