Skip to content
This repository has been archived by the owner on Apr 26, 2023. It is now read-only.

WARNING: duplicate object description #30

Open
mezhaka opened this issue Jan 8, 2021 · 0 comments
Open

WARNING: duplicate object description #30

mezhaka opened this issue Jan 8, 2021 · 0 comments

Comments

@mezhaka
Copy link

mezhaka commented Jan 8, 2021

A Python class with type annotation produces a warning: WARNING: duplicate object description during the sphinx-build if the sphinx.ext.napoleon extension is used. This used to not produce any warnings on version 1.8.5 of sphinx, but produces the warnings in version 3.4.3.

To Reproduce
Steps to reproduce the behavior:

#!/usr/bin/env bash
set -e
set -x

mkdir repro && cd repro
mkdir -p docs/source


cat << EOF > generate_warning.py
class Test:
    """
    Attributes:
        attr: a doc
    """

    attr: bool
EOF


cat << EOF > docs/source/conf.py
import os
import sys
sys.path.insert(0, os.path.abspath('../../'))

extensions = [
    'sphinx.ext.napoleon',
]

source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'
EOF


cat << EOF > docs/source/index.rst
.. toctree::

   apidoc/modules
EOF

# I use conda to create environemnts, but if you don't create a virtual env with
# sphinx 3.4.3 instead of the following block
cat << EOF > environment.yml
name: sphinx-duplicate-warning
channels:
  - conda-forge
  - nodefaults

dependencies:
  - sphinx==3.4.3
EOF

conda env create

Then activate the environment and run sphinx build:

cd repro
conda activate sphinx-duplicate-warning

sphinx-apidoc --force --separate -o docs/source/apidoc . && sphinx-build -M html "docs/source" "build"

Expected behavior
No warning

Your project
repro.zip

Environment info

  • OS: MacOS 10.15.7
  • Python version: 3.8.6
  • Sphinx version: 3.4.3
  • Sphinx extensions: sphinx.ext.napoleon
  • Extra tools: [e.g. Browser, tex or something else]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant