Description
Is your feature request related to a problem? Please describe.
Let's suppose we have a few related classes which are written in separate files, but for convenience are exposed higher up:
dog/
- __init__.py
- chihuahua.py
- pug.py
- labrador.py
- golden_retriever.py
with the main __init__.py
file looking something like:
from .chihuahua import ChihuahuaDog
from .pug import PugDog
from .labrador import LabradorDog
from .golden_retriever import GoldenRetrieverDog
__all__ = [
"ChihuahuaDog",
"PugDog",
"LabradorDog",
"GoldenRetrieverDog"
]
It would appear that Griffe documents each of these classes twice: once where they are defined, and second time for their re-export through dog/__init__.py
.
The duplicated docs are unnecessary and can be a little confusing at first.
Describe the solution you'd like
A way to avoid the duplication and have each class be documented only once.
A nice solution I have seen would be to have a list of re-exports in the same way that the Rust docs do it. See here and here for some examples. Note that the latter example is a common practice in Rust to have a module called prelude
whose sole purpose is to re-export commonly used types.
If it isn't possible for Griffe to detect re-exports, an alternative might be to have some sort of in-file documentation, or perhaps a separate configuration.
Describe alternatives you've considered
The only alternatives I can image are either to:
- Live with the duplication, or
- Don't put re-exports in
__all__
in which case the re-export is entirely hidden.