Skip to content

Make api docs toctrees be trees #1548

@wshanks

Description

@wshanks

Starting with Sphinx 8.1, the docs build gets spammed with lines like:

qiskit-experiments/docs/stubs/qiskit_experiments.library.characterization.FineXDrag.rst: document is referenced in multiple toctrees: ['apidocs/library', 'apidocs/mod_characterization'], selecting: apidocs/mod _characterization <- stubs/qiskit_experiments.library.characterization.FineXDrag

The reason is that we have been following a pattern of putting every experiment into the toctree of qiskit_experiments/library/__init__.py and qiskit_experiments/library/<submodule>/__init__.py. The toctree is supposed to be tree-like so the nodes should only be at the end of one branch but we have them at the end of two. Sphinx uses the tree structure to decide which part of the table of contents to expand when a given page is viewed (see sphinx-doc/sphinx#12888). Can still link to the experiments from both the library and submodule landing pages but they should only appear in the toctree for one or the other (probably only the submodule).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions