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
py3: HTML documentation for GlobalOptions does not show up correctly #28698
Comments
comment:1
Can you provide more details? From the Sage command line or from the Jupyter notebook, if I type |
comment:3
I confirm the bug in Sage 9.0.beta4 (Python 3 version). It holds for |
comment:4
The following (non-sensical) change in --- a/src/sage_setup/docbuild/ext/sage_autodoc.py
+++ b/src/sage_setup/docbuild/ext/sage_autodoc.py
@@ -1477,17 +1477,17 @@ class AttributeDocumenter(DocstringStripSignatureMixin, ClassLevelDocumenter):
isattribute = isdatadesc or (not isinstance(parent, ModuleDocumenter) and isattr)
# Trac #26522: This condition is here just to pass objects of classes
# that inherit ClasscallMetaclass as attributes rather than method
# descriptors.
isattribute = isattribute or isinstance(type(member), ClasscallMetaclass)
- if PY2:
+ if PY2 or True:
return isattribute
# That last condition addresses an obscure case of C-defined
# methods using a deprecated type in Python 3, that is not otherwise
# exported anywhere by Python
return isattribute or (not isinstance(parent, ModuleDocumenter) and
not inspect.isroutine(member) and
not isinstance(member, type)) The problem is that Note that Also note that Any ideas how to solve this? It would be good if we could avoid adding a special case for |
comment:5
@kwankyu: any suggestions? |
Author: Kwankyu Lee |
Branch: u/klee/28698 |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Commit: |
comment:8
Replying to @mwageringel:
The problem is that I don't clearly understand what the "obscure case" is. Anyway, the extra check is apparently doing more harm than good to sage documentation. In the patch, I turned off that check, as you originally suggested. I expect the generated documentation is more close to the version in python 2. We need to examine the generated documentation to see if there is any regression from the version in python 2. |
comment:10
I ran a diff on the generated html files before and after the patch using Python 3. The change mainly affects all the Besides FiniteStateMachine.default_format_letter which is just an alias to an imported function
so However, this patch also affects a number of attributes that completely disappear from the documentation after the patch, for example: AbstractGrowthGroupFunctor.rank, Are these supposed to appear in the documentation or not? Most of them do not have documentation strings attached to them, but some do (possibly unintentionally), for example: |
comment:11
Replying to @mwageringel:
Thanks.
Good.
Seems ok.
They did not appear in python 2 documentation, but started to appear in python 3 documentation by #26949, perhaps because of the extra check in
This example is interesting. The attribute Then why the docstring was moved to class docstring? Perhaps because the attribute docstrings do not get doctested. I think this is a defect of sage doctesting -- the original docstring was nice! To summarize, I see no regression from your report. |
Reviewer: Markus Wageringel |
comment:13
Ok, thank you for the explanations. Considering that the documentation in Python 3 now seems to agree with the usual Python 2 documentation, this is good to go then. |
Changed branch from u/klee/28698 to |
With Python 3, the HTML documentation for
GlobalOptions
does not show the docstring, but something else. For example in the case ofQQbar.options
, this is what gets displayed:This is what is called "String form" in the introspection
QQbar.options?
.With Python 2, the HTML documentation shows the "Docstring" as desired:
This is not unique to
QQbar
, but can also be seen withTableaux.options
, for instance.CC: @kwankyu
Component: python3
Author: Kwankyu Lee
Branch/Commit:
16b5e11
Reviewer: Markus Wageringel
Issue created by migration from https://trac.sagemath.org/ticket/28698
The text was updated successfully, but these errors were encountered: