New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Hide imported symbols (objects, modules etc) #656
Comments
Hello, thanks for the feature request 🙂 To know which objects to render, mkdocstrings-python uses Griffe's Looking at the code, these imported classes should not be considered public 🤔 Is it possible that these imported classes are listed in your modules' |
You are absolutely right - they are in the package's |
Well, adding such imported classes to
We actually have the same "issue" in Griffe itself: most public objects are rendered in the top-level page (https://mkdocstrings.github.io/griffe/reference/griffe/#griffe.Attribute) and again in submodule pages (https://mkdocstrings.github.io/griffe/reference/griffe/dataclasses/#griffe.dataclasses.Attribute). But that's entirely my fault: my public API is ambiguous. Some objects are explicitly exposed in multiple places (in Now, I still have ideas to improve the situation when API docs rendering is automated (for example with One idea is that we could have options to render links to already rendered objects instead of rendering them again. Either explicitly, by adding a "preferred location" marker on objects, or implicitly, for example by considering the public location to be the highest one in the package ( There are probably more ways to achieve such improvements, but the thing is Python doesn't have a standard for marking objects as public: we only have somewhat weak conventions, like prefixing names with |
thank you for such detailed explanation. The mkdocstrings is way better than any alternatives so I just happily moved from lazydocs. Cross-links from the main documentation to autogenerated from docstrings literals is just a wonderful feature. |
Linking to mkdocstrings/griffe#256 as I raised a similar question. In that issue, I draw inspiration from the way Rust handles re-exports in the documentation. |
Is your feature request related to a problem? Please describe.
TOC for module shows imported symbols in addition to the symbols that are defined in the module.
That clutter the TOC because they are not distinguished from symbols defined in the module.
Moreover, if I create TOC of my package, there will be a lot of duplications - the same symbols will be listed where they were defined and were they imported.
Describe the solution you'd like
Option to hide the imported symbols.
Describe alternatives you've considered
I do not see any other solution.
Additional context
We will see something like that (full paths not in the TOC but inside the page, just illustration how confusing it is)
The text was updated successfully, but these errors were encountered: