-
Notifications
You must be signed in to change notification settings - Fork 20
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
quartodoc ignores imported attributes #298
Comments
Hey! Does the include_imports option work? # _quarto.yaml
quartodoc:
...
sections:
- title: Some title
contents:
- name: module
include_imports: true I think that should tell it to include objects imported into the module. This is analogous to sphinx's import-members option. Sorry for the confusion. I think it's there so packages that document per module don't accidentally document functions multiple times, but I can see how it's frustrating to debug :/. (In the same vein, classes don't document inherited members by default). If you want, you can set the option everywhere. |
@machow Thanks for the quick response. I didn't find it in the documentation. I believe it will work, I will close the issue tomorrow when I get to try it. Does it automatically ignore third-party imports? What if I used it on module like this: # package/module.py
from sklearn.pipeline import Pipeline
from my_package.other_module import CONSTANT
__all__ = ["CONSTANT"] |
@machow I'm afraid it doesn't work. I have a rather complex and private case, so I'll try to simplify it for reproducibility. # package/module.py
import asyncio # _quarto.yaml
quartodoc:
package: package
...
sections:
- title: Some modules
contents:
- name: module
include_imports: true It raises error: Error
Versions
|
Currently it ignores third party imports, and all non-external functions in the module can be members. (The net effect is that I think your example should do what you want). I added a fix to PR #300, which uses edit: released https://github.com/machow/quartodoc/releases/tag/v0.6.5 |
It seems like this should be fixed in the current version. I tested using this code: from quartodoc import Auto, blueprint, MdRenderer, preview
bp = blueprint(Auto(name = "quartodoc.tests.example_alias_target__nested", include_imports = True))
# note that the tabulate function, which was imported into the module
# gets rendered in the API doc page for the module
print(MdRenderer().render(bp)) Definitely let me know if it's still an issue, and I can dig into it more. |
Problem
When I only import attributes (and specify them to
__all__
) in a rendered, quartodoc ignores them and doesn't render its documentation.This is a problem because often in packages you have "private part of the package", and you only expose the "public" part via imports like that. For example you have a structure like this:
Solution
Similar to
pdoc
: what to render can be decided based on contents of__all__
. For exampleNOT_SHOWN_CONSTANT
shouldn't be rendered because it is not in__all__
.The text was updated successfully, but these errors were encountered: