#๐Ÿ”’ Sphinx documentation, MANY ERRORS :(

8 messages ยท Page 1 of 1 (latest)

primal dove
#

Hello everyone, I am using sphinx for the first time and running into some issues.

My code is structured like this. I have a package like

ctamain/
  __init__.py
  module1/
    __init__.py
    func1.py
    func2.py
  module2/
    __init__.py
    func3.py
    func4.py

And using sphinx to automatically document it. The problem is, that it seems to be getting duplicate references when making the documentation.
The conf.py looks like:

# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html


import os
import sys
sys.path.insert(0, os.path.abspath("../../source/python/ctamain"))

project = 'CTADocs'
copyright = '2025, CTA'
author = 'CTA'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
    'sphinx.ext.todo', 
    'sphinx.ext.viewcode', 
    'sphinx.ext.autodoc',
    'sphinx.ext.autosummary', 
    'sphinx.ext.napoleon',
    'myst_parser',
]

templates_path = ['_templates']
exclude_patterns = [
    '_build', 
    'Thumbs.db', 
    '.DS_Store',
]

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
autosummary_generate = True
default_role = 'py:obj'
autodoc_typehints = 'description'

html_css_files = ['custom.css']

source_suffix = {
    '.rst': 'restructuredtext',
    '.md': 'markdown',
}
cerulean crescentBOT
#

@primal dove

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

primal dove
#

And when I use make clean; make html;, I get errors like:

C:\Code\redacted\source\python\ctamain\types.py:docstring of ctamain.types:1: WARNING: duplicate object description of ctamain.types, other instance in ctamain/ctamain.types, use :no-index: for one of them
C:\Code\redacted\source\python\ctamain\__init__.py:docstring of ctamain:1: WARNING: duplicate object description of ctamain, other instance in ctamain/ctamain, use :no-index: for one of them

I don't understand why.

#

It makes a new directory in the documentation folder called ctamain, which is the ctamain/ctamain.types reference f.e, but it also finds the ctamain.types in the source code..

#

The index.rst looks like this

My Example Documentation
=========================================

description.

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

   modules
#

!close

cerulean crescentBOT
#
Python help channel closed with !close

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.