Questions tagged [autodoc]

Extension for the Sphinx documentation generator that imports Python modules in order to extract docstrings in a semi-automatic way.

Python Sphinx extension that can import the modules being documented, and pull in documentation from docstrings in a semi-automatic way.

The sphix.ext.autodoc extension can be used in conjunction with the sphinx.ext.napoleon extension. This allows use of NumPy and Google style docstrings. The Napoleon prepocessor will initially convert your docstrings to ReStructured text, that afterwards is processed by autodoc.

Several commonly used directives are provided by autodoc, namely ..automodule:: and ..autoclass: For examples of use see the sphinx.ext.autodoc documentation.

See also:

456 questions
0
votes
0 answers

"No module named 'airflow'" in Sphinx

I want to show my python code in sphinx, however when I run "make html" it shows some errors. The main file name is Compliance_modular.py and the error is the next one: WARNING: autodoc: failed to import module 'Compliance_modular'; the following…
M_A
  • 11
  • 4
0
votes
2 answers

genindex and modindex footer links don't work in readthedocs.io

I have a Python project using Sphinx for docs. I am building the docs remotely on readthedocs.io service. I used sphinx-quickstart and it generated an index.rst file with these links in the footer: Indices and tables ~~~~~~~~~~~~~~~~~~ *…
Anentropic
  • 32,188
  • 12
  • 99
  • 147
0
votes
1 answer

Travis fails to convert ipython notebook to html

I am having an issue with generating HTML from ipython notebook using Travis. Autodoc is failing with the following error. building [html]: targets for 36 source files that are out of date updating environment: [new config] 36 added, 0 changed, 0…
0
votes
1 answer

Sphinx python: autodoc does not import class methods defined in other source files

In my project, I have a class EnergyModel defined in energymodel.py. There is also generate_data class method imported from another source file: #energy_model.py from .energy_model_data_generation import generate_data class…
Mikhail Genkin
  • 3,247
  • 4
  • 27
  • 47
0
votes
0 answers

sphinx creates an empty documentation

Assume the following is the structure of my code: A/ __init__.py B.py Run.py I go ahead and install sphinx and numpydoc extension. Then I issue sphinx-quickstart and choose the default (don't separate the source and builder)…
math
  • 341
  • 4
  • 14
0
votes
0 answers

Sphinx does not read my function docString?

I tried to auto docstring every module functions inside my project, but sphinx-apidoc does not read my function and doc string. my project structure is like this mktpip ├── docs │   ├── Makefile │   ├── build │   ├── make.bat │   └── source │   …
Houy Narun
  • 1,557
  • 5
  • 37
  • 86
0
votes
1 answer

Sphinx and autodoc: numpy.core.multiarray failed to import + mock has unsupported operand type

I am trying to build the documentation for my project (https://github.com/pyMatJ/S4Utils) using sphinx and autodoc, targeting RtD eventually (https://s4utils.readthedocs.io/en/latest/). So far I managed to make the whole project installable and I…
pyMatJ
  • 3
  • 2
0
votes
1 answer

Sphinx ignores .rst files

make html and sphinx-build 'source' 'build\html' -a -E give the same results; an .rst file in docs/source I modified is being overridden when I add to :exclude-members: here, generating docs with said member present. Same behavior if simply wiping…
OverLordGoldDragon
  • 1
  • 9
  • 53
  • 101
0
votes
1 answer

Sphinx autodoc: inherit docstrings without inheriting class

I have two classes which share an API through duck typing, but do not share any inheritance: class A: def method(): """Does something.""" pass class B: def method(): pass I have written docstrings for A, but not B.…
japreiss
  • 11,111
  • 2
  • 40
  • 77
0
votes
0 answers

How to render whitespace explicitly in sphinx documentation?

I'm one of the maintainers of sqlfluff, and I'd like to replicate similar pattern and anti-pattern examples to the flake8 documentation here: https://www.flake8rules.com/rules/E101.html At the moment the default styling for code-block sections in…
Slipstream
  • 385
  • 3
  • 10
0
votes
0 answers

Document links to other packages in sphinx

I use the sphinx_autodoc_typehints extension for my python project. In my project, I have a few dependencies to other packages like my_base_package. [setup.py] setup( install_requires=[ "my_base_package @ git+ssh://xxxxxx" ] ) Is it…
user5580578
  • 1,134
  • 1
  • 12
  • 28
0
votes
0 answers

Autodata: document a callable without signature with autodoc-typehints

I'd like to document an attribute of a module which holds a callable, more specifically a type. This attribute is intended to store some type, not be an alias of the type. When I document the attribute, Sphinx renders the call signature of the type…
Felix
  • 2,548
  • 19
  • 48
0
votes
0 answers

show-inheritance referring to relocated class breaks the link

I'd like to document my class inheriting from a base, both of which are inside a submodule of a larger package. This package imports the classes to the very top level for a better user experience. For that reason I've also made my documentation on…
Felix
  • 2,548
  • 19
  • 48
0
votes
1 answer

Is there a way to hide autodoc of exceptions and save methods?

I'm documenting a huge Django project and would like to have an option to hide autogenerated Django stuff like below. Is it something I have to "deal with" or is there a setting I haven't found yet? I document with: .. automodule:: module.models …
Archarachne
  • 235
  • 1
  • 5
  • 18
0
votes
1 answer

autodoc: failed to import module 'routes' from module 'app_folder'

I am trying to use Sphinx and it's giving me errors. What am I missing here? WARNING: autodoc: failed to import module 'routes' from module 'app_folder'; the following exception was raised: No module named…
e.T55
  • 443
  • 1
  • 4
  • 21