-1

Trying to set up documentation using Sphinx, using the command sphinx-apidoc -o source/_autosummary ../tests produces the right .rst files. Using the command sphinx-build -W -b html -d build/doctress source/ build/html only produces a test.rst file and the contents of that file is only

tests
=====

.. currentmodule:: tests

.. automodule:: tests

Wondering if anyone had any clue as to why it's doing this.

File tree structure:

Project_1
├── tests
├── docs

tests (contains _init_.py)
|--bc_folder (contains _init_.py)
├── HV
├── image
├── Prebuild (contains _init_.py)
├── resf
│   ├── fs
│   ├── firewall
│   ├── vm_l
│   └── vm_t
├── unit_tests
├── utils
│   ├── framework (contains _init_.py)
│   ├── HV (contains _init_.py)
│   ├── resf (contains _init_.py)
│   └── vm (contains _init_.py)
└── vm
    ├── test_1
    └── test_2


docs
|-source
  ├── _autosummary
  │   └── tests.rst
  ├── _static
  ├── _templates
  │   ├── custom_class_template.rst
  │   └── custom_module_template.rst
  ├── conf.py
  ├── index.rst
  └── tests.rst

index.rst

.. toctree::
   :maxdepth: 1
   :caption: Contents:

   tests

conf.py

sys.path.insert(0, os.path.abspath("../.."))

extensions = [
    "sphinx.ext.autodoc",
    "sphinx.ext.autosummary",
    "sphinx.ext.napoleon",
    # "myst_parser",
    # "sphinxarg.ext",
]

autosummary_generate = True
templates_path = ["_templates"]
exclude_patterns = [
    "_build",
    "Thumbs.db",
    ".DS_Store",
]

If there's any other information needed I'm more than willing to provide!

Using the command sphinx-apidoc -o source/_autosummary ../tests produces the right .rst files. Using the command sphinx-build -W -b html -d build/doctress source/ build/html only produces a test.rst file and the contents of that file is blank (I was expecting at least 7 .rst files created based on the folders with a __init__.py file)

mzjn
  • 48,958
  • 13
  • 128
  • 248
  • sphinx-build does not generate RST files. It generates HTML (or other output such as LaTeX) from existing RST files. – mzjn Aug 04 '23 at 10:02
  • Ah I see when I try using the sphinx-build command after sphinx-apidocs I receive a failed to import module error even though I know I set the sys.path correct in my conf.py file; any other reason as to why it may not be retrieving the modules correctly? Can create a separate question if this is derailing – Deferrent Aug 04 '23 at 18:43
  • Without a [mcve] or at least the exact error message and the `automodule` directive that caused it, it is hard to help. Maybe you can get some hints from similar old questions about failed imports. For example: https://stackoverflow.com/q/57763542/407651, https://stackoverflow.com/q/50230797/407651, https://stackoverflow.com/q/41925973/407651 – mzjn Aug 04 '23 at 20:04

0 Answers0