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
Python 3 vs. Sphinx, part 2: classes inheriting from ClasscallMetaclass #26522
Comments
This comment has been minimized.
This comment has been minimized.
comment:3
This is important to fix; otherwise, the Python 3 build of the reference manual will be very incomplete, missing methods from every class that inherits from |
comment:5
This change doesn't help, but is there any reason not to do this: diff --git a/src/sage/structure/unique_representation.py b/src/sage/structure/unique_representation.py
index 4fc44c8b86..e08393954b 100644
--- a/src/sage/structure/unique_representation.py
+++ b/src/sage/structure/unique_representation.py
@@ -561,13 +561,13 @@ accordingly, for example by inheriting from
#******************************************************************************
from __future__ import print_function
-from sage.misc import six
+from six import with_metaclass
from sage.misc.cachefunc import weak_cached_function
from sage.misc.classcall_metaclass import ClasscallMetaclass, typecall
from sage.misc.fast_methods import WithEqualityById
-class CachedRepresentation(six.with_metaclass(ClasscallMetaclass)):
+class CachedRepresentation(with_metaclass(ClasscallMetaclass)):
"""
Classes derived from CachedRepresentation inherit a weak cache for their
instances. |
This comment has been minimized.
This comment has been minimized.
comment:6
A little more experimentation has led me to change the ticket description. I think the problem is with |
comment:7
I should note that if I add methods to |
comment:8
This looks like very generic code which is not really even dependent upon Sage, so one can create a separate sphinx testcase for it, right? |
comment:9
If someone could figure out what's going wrong, that would be preferable to making a special case of it. Is it because |
comment:10
On my sage-on-gentoo install I'm able to complete building the docs with python3 if I disable catching the diff --git a/src/sage_setup/docbuild/sphinxbuild.py b/src/sage_setup/docbuild/sphinxbuild.py
index 8f7034fcb8..6cfdb10080 100644
--- a/src/sage_setup/docbuild/sphinxbuild.py
+++ b/src/sage_setup/docbuild/sphinxbuild.py
@@ -250,8 +250,8 @@ class SageSphinxLogger(object):
OSError: This is a SEVERE error
"""
- if self._error is not None:
- raise OSError(self._error)
+# if self._error is not None:
+# raise OSError(self._error)
_line_buffer = '' Perhaps someone can try this on vanilla to see if it works with python3. If it works then perhaps we can determine which pieces are missing. |
comment:11
This is probably what @jhpalmieri was indicating. Under Correct doc
Incorrect with python3
And perhaps other places. |
comment:12
For another illustration, navigate in the reference manual by choosing This is what actually causes the documentation to fail to build with Python 3: a cross-reference to "facade-sets" points to what becomes omitted in the Python 3 build of the documentation. |
comment:13
Also, python3 appears to not be picking up on external links. From the python2:
python3:
It's not clear to me where these external links originate. |
comment:14
I wonder if those links come from |
comment:15
Confirmed: if I download |
comment:16
See #26859 for the |
comment:17
Replying to @jhpalmieri:
There is a bug in some versions of |
comment:18
Replying to @embray:
In |
comment:19
I'm wondering if there is a problem with the inventory builder. Here, for example, with python3 most everything is missing under 'Finite Coxeter Groups' including the |
comment:20
Note that |
comment:21
Another data point. With Python3 numerous entries in inventory
is assigned the
to view the file contents. |
comment:22
That's interesting. I don't understand anything about how Sphinx generates the inventory files. I've tried poking around, but I'm not getting anywhere. |
comment:23
Please check out #26949 |
comment:24
Replying to @kwankyu:
I'll be interested in your comments. It probably would have been better to have the commits in this location but so be it. The html-docs do build for me but I haven't been able to view them. I do notice some
|
comment:25
There are subtle differences under Sets. We need a central place to discuss this. |
comment:26
Those invalid escape sequences crop up in the Python 3 docbuilding process. Other tickets have removed many of them. |
comment:28
Now fixed by #26949. |
comment:29
Cool, thank you. |
(split off of #26449)
With a Python 3 build of Sage, Sphinx omits large chunks of the autodoc documentation. It seems to be related to classes which inherit from
ClasscallMetaclass
and which also have class-level docstrings. For example, if I have this:then Sphinx will produce output looking like this:
Test1
is properly documented, butTest2
is missing documentation for the methods; furthermore, it doesn't say "class" at the beginning and does not list the base class.Classes which inherit from other classes, say
WithEqualitybyId
, work just fine.CC: @fchapoton @jdemeyer @embray
Component: python3
Issue created by migration from https://trac.sagemath.org/ticket/26522
The text was updated successfully, but these errors were encountered: