Skip to content

Ignoring python files that are present inside a directory with an __init__.py file. #10138

Open
@swarajbadhei

Description

@swarajbadhei

Describe the bug

While running sphinx-apidoc -f -o .\source ..\path_to_source\ python files present inside \path_to_source\ are getting ignored as there is an __init__.py(empty) file is present. Once the __init__.py file is removed, works like a charm and .rst file for all the python files are getting generated. Can not remove all the init.py files as it would affect the python build of the packages. Path in conf.py is also set the way its supposed to be.

Python 3.6
Sphinx 4.4.0, 1.8.0
OS : Win10 and Unix

How to Reproduce

This is a loose interpretation to reproduce the issue.

> cd project_dir
> mkdir docs
> cd docs
> sphinx-quickstart
> cd source

>>>> make changes and set the path in `conf.py` file.

> cd ..
> sphinx-apidoc -f -o ../path_to_source/

Expected behavior

Ideally, .rst file for all the python files present inside the source code folder should be created.

Your project

NA

Screenshots

No response

OS

Win10, Unix

Python version

3.6

Sphinx version

1.8.0, 4.4.0

Sphinx extensions

sphinx.ext.autodoc , sphinx.ext.napoleon

Extra tools

No response

Additional context

The following link describes something like the mentioned issue but the solution did not seem to work.

https://stackoverflow.com/questions/67945351/how-to-configure-sphinx-autodoc-to-document-classes-in-init-py/70880053#70880053

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions