-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
feat: Allow resolving alias to external modules #60
Conversation
Hello, thanks for the PR! May I ask what is your use-case, and what you think of this comment mkdocstrings/mkdocstrings#503 (comment)? |
Basically I have a rather large library that is exposed through multiple independent modules with other 'root' names - they do not share a package name (a bad case of need to preserve backward computability). The use of I think I can manage with pre loading as you suggested in the issue you have referenced, although it will require a bit more manual work, of finding out which modules to pre-load. I think I can change this PR to add From my POV the external and selectively using |
I see, thanks.
Yeah, because of the lack of a standard way to "export" objects or make them public,
Just to be clear: the preload solution would add a configuration option in the Python handler, and its value would be used as early as possible to load the specified modules in the handler's Both (preload, and external+ I'm imagining something like this: starting from scratch, users temporarily allow loading external modules, and at the end of the build, the Python handler outputs an info/debug message suggesting to disable external loading and enable pre-loading with the list of external modules it loaded during the build. Maybe we could even try to exclude modules for which no objects were rendered from this suggested list. But these are nice-to-have, it could be done later. If you feel like implementing both, that would be awesome! I'd recommend doing it in two distinct PRs. Let me know if that makes sense! In any case this conversation helped me clear my mind and I can see the path forward, so I'd eventually get it to it 🙂 |
5516ddf
to
3d9eb81
Compare
I changed the PR to preload modules. It works good enough for my use case, and I'm ok with that, and with adding external at a different PR. Let me know if you think that is good enough. |
f3f704e
to
a2bc632
Compare
Hello! No worries, pinging me is the right way 🙂 |
6bcd7df
to
b774ff7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, sounds good to me. I checked it out and it seems it's not possible to preload the modules in the __init__
method yet. So lets do it this way for now and maybe we'll refactor later 🙂 Thanks a lot!
53ca4da
to
fe64e72
Compare
Add option to preload external modules that are not part of the displayed documentation to allow resolving aliases to objects in these modules, and presenting their documentation in a module that imports them, and exports the imports with `__all__` attribute.
fe64e72
to
d9a6326
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
PR #61: #61 Follow-up of PR #60: #60 Co-authored-by: gilfree <[email protected]>
Hi
I would like to suggest adding an option (false by default) to set griffe's resolve external modules flag to true.
What are your thoughts about it? Did I do it correctly? As I am not a native English speaker, my documentation my need some improvement.