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.
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.
The only alternatives I can image are either to:
__all__
in which case the re-export is entirely hidden.Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too