-
Notifications
You must be signed in to change notification settings - Fork 131
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 objects to render in their own pages #399
Conversation
3b97468
to
6ef44ea
Compare
Thanks for this amazing package @ericholscher @AWhetter. I would like to request your guidance and feedback to complete this pull-request. I tried it to have the lowest impact as possible on the default templates. For writing the tests, I created a copy of the These are the warnings raised by the tests: /sphinx-autoapi/tests/python/pypackagecomplex_single_page/autoapi/complex/wildall/simple/SimpleClass.rst:7: WARNING: duplicate object description of SimpleClass, other instance in autoapi/complex/wildall/SimpleClass, use :no-index: for one of them
/sphinx-autoapi/tests/python/pypackagecomplex_single_page/autoapi/complex/wildall/simple/SimpleClass.rst:14: WARNING: duplicate object description of SimpleClass.simple_method, other instance in autoapi/complex/wildall/SimpleClass, use :no-index: for one of them
looking for now-outdated files... none found
pickling environment... done
checking consistency... /sphinx-autoapi/tests/python/pypackagecomplex_single_page/autoapi/complex/wildall/simple/NotAllClass.rst: WARNING: document isn't included in any toctree Do you have any suggestions on how to fix those? As far as I understand, only one reference to an object should exist. However, I am not really sure where should I impose this condition. |
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.
Thank you so much for your patience, and for making such a large contribution! 🎊
I've made some comments, and also pitched a couple of suggestions that it would be great to have your opinion on.
Please could we add some documentation for this change, as you've already noted in your description. Documentation makes it a bit easier to review because it means that I'll better understand how you intend the feature to work. Also it'll force you to explain how the change works, and if it's hard to explain then it's going to be hard for users to understand.
Finally, you'll need to include a news fragment through towncrier, to get the tests to pass. The README explains how to do this.
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.
We don't need to test absolutely everything that the pypackagecomplex
test was created for (eg the rendering of binary data, different docstring styles, wildcard imports). So should we simplify this test case down and maybe come up with our own test case that checks for only what's relevant for single page rendering?
The latest commits ensure the desired structure. I had to introduce a recursive function named Also, I fixed some minor issues in the |
Still need to address the TODO in the |
The TODO in the This generates Focusing now on completing the tests. |
Finally! This is working really nice. It supports all the capabilities @AWhetter asked for. I am glad that we extended to these. Honestly, this looks super flexible! |
The latest modifications by @AWhetter as way more elegant and readable than my recursive function. After giving a try to this in some of our projects, I could find the following issues:
|
It looks like for |
b674b52
to
1668f92
Compare
Last commit fixes the issues with exceptions. |
Commit 2ef9a9d ensures that if |
I'm closing this because it has been merged with further changes into |
Thanks for all the feedback and support, @AWhetter. Glad to see this is finally merged into main branch 🚀 |
Fix #226 by allowing certain objects to be rendered in single pages. Main changes are:
New configuration variable
autoapi_own_page_level
This configuration variable accepts one of package, module, exception, class, function, method, property, attribute, data. Single pages are generated until the desired depth level. For example:
Module depth
Class depth
Function depth
Property depth
Adapt default templates to operate with this new option
Any template contains the two variables
is_own_page
andown_page_types
. Using these two variables it is possible to customize the templates to operate with or without single pages. Default behavior will be the one prior to introducing this feature.