Skip to content

sphinx-apidoc duplicate lines in genrated rst files if module is a cpython extension module #9614

Open
@twmr

Description

@twmr

Describe the bug

sphinx-apidoc -M -o modules/pkg pkg generates files that contain duplicate entries if pkg.wrapper is an cpython extension module (.so file). The generated rst file looks like

pkg package
===========

.. automodule:: pkg
   :members:
   :show-inheritance:

Submodules
----------


pkg.lockable\_plugin module
---------------------------

.. automodule:: pkg.lockable_plugin
   :members:
   :show-inheritance:

pkg.wrapper module
------------------

.. automodule:: pkg.wrapper
   :members:
   :show-inheritance:

pkg.wrapper module
------------------

.. automodule:: pkg.wrapper
   :members:
   :show-inheritance:

How to Reproduce

Build a python library that contains a cpython extension using multiple interpreters, s.t. the source tree of the python lib contains so files for multiple interpreters

./pkg/wrapper.cpython-39-x86_64-linux-gnu.so
./pkg/wrapper.cpython-37m-x86_64-linux-gnu.so

(./pkg is the source directory)

Expected behavior

The generated rst file must not contain duplicate entries.

Your project

Screenshots

No response

OS

Linux

Python version

3.7

Sphinx version

4.1.2

Sphinx extensions

autodoc

Extra tools

No response

Additional context

FYI I've reported a similar (apidoc related) issue in the past: #6986

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions