0

I am just trying out to document my project using sphinx. So I have gone through the sphinx documentations and few other tutorials and had configured my project accordingly. Also I have been doing the process under a virtual environment

My project structure looks like the below

.
data_server
├── com
│   ├── app
│   │   ├── __init__.py
│   │   ├── api
│   │   │   ├── __init__.py
│   │   │   ├── __pycache__
│   │   │   ├── file1.py
│   │   │   ├── file2.py
│   │   │   ├── file3.py
│   │   │   ├── file4.py
│   │   │   ├── file5.py
│   │   │   ├── scheduler
│   │   │   │   └── schedule.py
│   │   │   ├── file6.py
│   │   │   ├── file7.py
│   │   ├── config.py
│   │   ├── main.py
│   │   ├── service
│   │   │   ├── __init__.py
│   │   │   ├── dataservice.py
│   │   │   ├── dataconverter.py
│   │   │   ├── datagrouper.py
│   │   │   ├── datagrouping.py
│   │   │   └── user_data_manager.py
│   │   ├── setup
│   │   │   ├── indices_setup.py
│   │   │   ├── module_loader.py
│   │   │   ├── server_on_start.py
│   │   │   └── replica_mapping.py
│   │   ├── startup.py
│   │   └── worker_main.py

Under data_server I have created docs folder and have ran sphinx-quickstart

Then came back to data_server folder and ran sphinx-apidoc -o docs/ com/app/api, which generated ".rst" files under docs folder.

Add necessary configs to config.py file.

Included modules inside index.rst file

Sample file1.rst

api.file1 module
-------------------

.. automodule:: api.file1
   :members:
   :undoc-members:
   :show-inheritance:

api.file2 module
-----------------------------

.. automodule:: api.file2
   :members:
   :undoc-members:
   :show-inheritance:

modules.rst

api
===

.. toctree::
   :maxdepth: 4

   api

index.rst

Welcome to Server Documentation's documentation!
==================================================

.. toctree::
   :maxdepth: 2
   :caption: Contents:
   modules



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

but when I run make clean html I get the following error.

WARNING: autodoc: failed to import module 'audience' from module 'api'; the following exception was raised:
No module named 'api'

  • Looks similar to many old questions, for example https://stackoverflow.com/q/57763542/407651 and https://stackoverflow.com/q/50230797/407651. – mzjn May 24 '23 at 09:10

0 Answers0