Introduction
I have created a web-app python project with the following structure (source files omitted from tree
command for clarity)
<code>$ tree -I *__pycache__* -L 2 -P *.py my_project/
my_project/
├── __init__.py
├── backend
│ ├── __init__.py
│ ├── clients.py
│ ├── config.py
│ ├── fetchers.py
│ ├── filters.py
│ ├── logger.py
│ ├── matchers.py
│ ├── plotters.py
│ ├── types.py
│ └── utils.py
└── frontend
├── __init__.py
├── assets
├── callbacks.py
├── components.py
├── config.py
├── ids.py
├── layout.py
├── main.py
└── maindash.py
</code>
<code>$ tree -I *__pycache__* -L 2 -P *.py my_project/
my_project/
├── __init__.py
├── backend
│ ├── __init__.py
│ ├── clients.py
│ ├── config.py
│ ├── fetchers.py
│ ├── filters.py
│ ├── logger.py
│ ├── matchers.py
│ ├── plotters.py
│ ├── types.py
│ └── utils.py
└── frontend
├── __init__.py
├── assets
├── callbacks.py
├── components.py
├── config.py
├── ids.py
├── layout.py
├── main.py
└── maindash.py
</code>
$ tree -I *__pycache__* -L 2 -P *.py my_project/
my_project/
├── __init__.py
├── backend
│ ├── __init__.py
│ ├── clients.py
│ ├── config.py
│ ├── fetchers.py
│ ├── filters.py
│ ├── logger.py
│ ├── matchers.py
│ ├── plotters.py
│ ├── types.py
│ └── utils.py
└── frontend
├── __init__.py
├── assets
├── callbacks.py
├── components.py
├── config.py
├── ids.py
├── layout.py
├── main.py
└── maindash.py
The contents of the __init__.py
files are the following:
<code>$ cat my_project/__init__.py
from .backend import (
CDFConfig,
client_credentials,
client_interactive,
TransmitterTypeFilter,
CDFFetcher,
RollingCorrelationMatcher,
EmptyTimeseriesFilter,
utils,
Logger,
PlotFactory,
)
from .frontend import (
ids,
callbacks,
config,
layout,
maindash,
main,
components,
)
__all__ = [
"CDFConfig",
"CDFFetcher",
"client_credentials",
"client_interactive",
"TransmitterTypeFilter",
"RollingCorrelationMatcher",
"EmptyTimeseriesFilter",
"utils",
"Logger",
"PlotFactory",
"ids",
"callbacks",
"config",
"layout",
"maindash",
"main",
"components",
]
</code>
<code>$ cat my_project/__init__.py
from .backend import (
CDFConfig,
client_credentials,
client_interactive,
TransmitterTypeFilter,
CDFFetcher,
RollingCorrelationMatcher,
EmptyTimeseriesFilter,
utils,
Logger,
PlotFactory,
)
from .frontend import (
ids,
callbacks,
config,
layout,
maindash,
main,
components,
)
__all__ = [
"CDFConfig",
"CDFFetcher",
"client_credentials",
"client_interactive",
"TransmitterTypeFilter",
"RollingCorrelationMatcher",
"EmptyTimeseriesFilter",
"utils",
"Logger",
"PlotFactory",
"ids",
"callbacks",
"config",
"layout",
"maindash",
"main",
"components",
]
</code>
$ cat my_project/__init__.py
from .backend import (
CDFConfig,
client_credentials,
client_interactive,
TransmitterTypeFilter,
CDFFetcher,
RollingCorrelationMatcher,
EmptyTimeseriesFilter,
utils,
Logger,
PlotFactory,
)
from .frontend import (
ids,
callbacks,
config,
layout,
maindash,
main,
components,
)
__all__ = [
"CDFConfig",
"CDFFetcher",
"client_credentials",
"client_interactive",
"TransmitterTypeFilter",
"RollingCorrelationMatcher",
"EmptyTimeseriesFilter",
"utils",
"Logger",
"PlotFactory",
"ids",
"callbacks",
"config",
"layout",
"maindash",
"main",
"components",
]
<code>$ cat my_project/backend/__init__.py
from .config import CDFConfig
from .clients import client_credentials, client_interactive
from .filters import TransmitterTypeFilter, EmptyTimeseriesFilter
from .fetchers import CDFFetcher
from .matchers import RollingCorrelationMatcher
from .utils import get_reference_fetcher
from .logger import Logger
from .plotters import PlotFactory
__all__ = [
"client_credentials",
"client_interactive",
"CDFConfig",
"CDFFetcher",
"TransmitterTypeFilter",
"RollingCorrelationMatcher",
"EmptyTimeseriesFilter",
"get_reference_fetcher",
"Logger",
"PlotFactory",
]
</code>
<code>$ cat my_project/backend/__init__.py
from .config import CDFConfig
from .clients import client_credentials, client_interactive
from .filters import TransmitterTypeFilter, EmptyTimeseriesFilter
from .fetchers import CDFFetcher
from .matchers import RollingCorrelationMatcher
from .utils import get_reference_fetcher
from .logger import Logger
from .plotters import PlotFactory
__all__ = [
"client_credentials",
"client_interactive",
"CDFConfig",
"CDFFetcher",
"TransmitterTypeFilter",
"RollingCorrelationMatcher",
"EmptyTimeseriesFilter",
"get_reference_fetcher",
"Logger",
"PlotFactory",
]
</code>
$ cat my_project/backend/__init__.py
from .config import CDFConfig
from .clients import client_credentials, client_interactive
from .filters import TransmitterTypeFilter, EmptyTimeseriesFilter
from .fetchers import CDFFetcher
from .matchers import RollingCorrelationMatcher
from .utils import get_reference_fetcher
from .logger import Logger
from .plotters import PlotFactory
__all__ = [
"client_credentials",
"client_interactive",
"CDFConfig",
"CDFFetcher",
"TransmitterTypeFilter",
"RollingCorrelationMatcher",
"EmptyTimeseriesFilter",
"get_reference_fetcher",
"Logger",
"PlotFactory",
]
<code>$ cat my_project/frontend/__init__.py
from . import ids
from . import callbacks
from . import config
from . import layout
from . import maindash
from . import main
from . import components
__all__ = [
"ids",
"callbacks",
"config",
"layout",
"maindash",
"main",
"components",
]
</code>
<code>$ cat my_project/frontend/__init__.py
from . import ids
from . import callbacks
from . import config
from . import layout
from . import maindash
from . import main
from . import components
__all__ = [
"ids",
"callbacks",
"config",
"layout",
"maindash",
"main",
"components",
]
</code>
$ cat my_project/frontend/__init__.py
from . import ids
from . import callbacks
from . import config
from . import layout
from . import maindash
from . import main
from . import components
__all__ = [
"ids",
"callbacks",
"config",
"layout",
"maindash",
"main",
"components",
]
Problem
I am building my documentation with sphinx, using the following rst
file for the API documentation:
<code>==========
My Project
==========
Backend
=======
.. automodule:: my_project.backend
:members:
:undoc-members:
:show-inheritance:
:private-members:
:special-members: __init__
Frontend
========
.. automodule:: my_project.frontend
:members:
:undoc-members:
:show-inheritance:
:private-members:
:special-members: __init__
</code>
<code>==========
My Project
==========
Backend
=======
.. automodule:: my_project.backend
:members:
:undoc-members:
:show-inheritance:
:private-members:
:special-members: __init__
Frontend
========
.. automodule:: my_project.frontend
:members:
:undoc-members:
:show-inheritance:
:private-members:
:special-members: __init__
</code>
==========
My Project
==========
Backend
=======
.. automodule:: my_project.backend
:members:
:undoc-members:
:show-inheritance:
:private-members:
:special-members: __init__
Frontend
========
.. automodule:: my_project.frontend
:members:
:undoc-members:
:show-inheritance:
:private-members:
:special-members: __init__
The backend is documented as expected, but only the header is shown for the frontend. Why is that? I think it has to do with the init files and the way I import functionality into the namespace, but I cannot figure what is wrong.