Best practices for aliases exposed in multiple public modules #63
-
hey @pawamoy, i have a question about "Multiple secondary URLs found". let's say I have a package with a class defined at I know i can cop-out and use |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hey @tlambert03! Good question. We do recommend exposing objects in unique locations. And we do have requests in the backlog for rendering links to objects rather than re-rendering them, as well as requests to improve summaries. For now there's no particular tip though 😕 Also note that mkdocstrings/griffe#357 is causing a lot of these "Multiple secondary URLs" warnings. |
Beta Was this translation helpful? Give feedback.
-
First off, that document is amazing 🤩. I will point others to it often. So well written, and the kind of thing that doesn’t get written about enough. Bravo. I still struggle a bit with the single public location suggestion though I guess 😂. I often use my top module to indicate “here are all the most important objects that you will likely interact with in this library”. I do hide most other modules, but often have one layer of public submodules as you describe for medium size libs. In those cases, I really would rather keep the object as a member of its submodules, because that provides context to what the object does (“ah, this is in models, must relate to models”) in a way that would not be immediately obvious if I just exported everything in a large top level namespace. At the same time, I do often want to indicate some objects as particularly special entry-point objects, and put those at the top namespace. For me, that provides clarity and immediately directs a newcomers eye to the most important bits of the package… (but I don’t want to lose the context by hiding it from the submodule’s init). anyway, that’s just some random thoughts. From a docs perspective, I think I will likely use resolve_closest for now, but I’m happy to have a better understanding of the principles behind the warnings, and would will keep an eye out for those backlogged issues. Thanks! |
Beta Was this translation helpful? Give feedback.
Hey @tlambert03! Good question. We do recommend exposing objects in unique locations. And we do have requests in the backlog for rendering links to objects rather than re-rendering them, as well as requests to improve summaries. For now there's no particular tip though 😕
Also note that mkdocstrings/griffe#357 is causing a lot of these "Multiple secondary URLs" warnings.