-
-
Notifications
You must be signed in to change notification settings - Fork 565
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.9 support cleanup in sage_autodoc and sphinx bump #39577
Conversation
… synchronization of sage_autodoc.py with upstream
Documentation preview for this PR (built with commit dabc390; changes) is ready! 🎉 |
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.
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!
@kiwifb with sphinx 8.2.3 I had to apply --- a/src/sage_docbuild/ext/sage_autodoc.py
+++ b/src/sage_docbuild/ext/sage_autodoc.py
@@ -2976,7 +2976,7 @@ class PropertyDocumenter(DocstringStripSignatureMixin, # type: ignore[misc]
def autodoc_attrgetter(app: Sphinx, obj: Any, name: str, *defargs: Any) -> Any:
"""Alternative getattr() for types"""
- for typ, func in app.registry.autodoc_attrgetters.items():
+ for typ, func in app.registry.autodoc_attrgettrs.items():
if isinstance(obj, typ):
return func(obj, name, *defargs)
Was it renamed in 8.2, or it's a typo in the branch? |
Seems familiar, I am fairly sure that's a renaming in 8.2. Let me check. |
OK I see it on the branch. I may have picked the wrong branch of the work around. Looking sphinx. |
Done my archeology. Yes I picked the wrong branch in the |
it's rather confusing. Which way are they moving to? They still have both spellings... |
Given the direction sphinx-doc/sphinx#11936 I would say any instances of |
It looks like there is an alias in place, at least in head, to match the two spellings https://github.com/search?q=repo%3Asphinx-doc%2Fsphinx%20attrgettrs&type=code and it was added as part of the PR above in sphinx. It seems more and more curious as to why you had to patch. |
can we install such an alias in our docs? |
I thought why not but now, I am not so sure. I am half surprised we do not benefit from sphinx's one. I need to get sphinx-8.2+ installed and see what happens for myself. |
I see this class SphinxComponentRegistry:
def __init__(self) -> None:
#: special attrgetter for autodoc; class object -> attrgetter
self.autodoc_attrgetters: dict[type, Callable[[Any, str, Any], Any]] = {}
[...]
@property
def autodoc_attrgettrs(self) -> dict[type, Callable[[Any, str, Any], Any]]:
return self.autodoc_attrgetters I never recall how exactly Python classes work, but you see that If I try to emulate this code structure I get
It's all more or less how it's documented in https://docs.python.org/3/library/functions.html#property, and I don't understand why it doesn't work for me. However, the latter docs seem to indicate that what's inside Edit: I should have written |
By the way, here is a naive attempt to reproduce this with sphinx 8.2.3, but to no avail:
|
Experimenting with sphinx 8.2.3. There are numerous errors and touching |
It worked for me with Python 3.12. Did you try with 3.13? |
Why it used python 3.12 instead of 3.13 is also on my TODO list of things to look at. |
I actually figured that one out, gentoo's ebuilds for sphinx-copybutton and sphinx-inline-tabs do not support python 3.13 yet. They block doc building with 3.13. |
I think this broke something with Sage. I see this in the Sphinx log file:
My guess is that sphinxcontrib-htmlhelp needs a version bump, too. Maybe some other components of Sphinx, in addition? This leads to Sage's Python to fail (some of the time, I don't know why not all of the time), and this leads to a failure of Sage to detect the correct number of CPUs to use for parallel processing. See https://groups.google.com/g/sage-devel/c/lr03GlRBr9g/m/Yx8yo7p4AQAJ. |
I definitely overlooked bumping those. |
Building on my Gentoo machine worked (modulo the fix above) as my sphinx and its deps come from the OS in my regular builds, and are quite new |
Can you see if #39686 helps you and review it please. |
I have been unable to build the doc with sphinx 8.2.3 so far. Even after updating sage_autodoc.py (on hold for now). The problem I have is completely unrelated
Which basically complains that |
OK, I have a rebase on sphinx 8.2.3 with a working update to |
sagemathgh-39686: update sphinxcontrib packages This is a follow up to sagemath#39577 where sphinx was update but not the sphinxcontrib packages. This causes breakages for some users. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies sagemath#39680 deals with one the packages that would be covered by this PR <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39686 Reported by: François Bissey Reviewer(s):
sagemathgh-39686: update sphinxcontrib packages This is a follow up to sagemath#39577 where sphinx was update but not the sphinxcontrib packages. This causes breakages for some users. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies sagemath#39680 deals with one the packages that would be covered by this PR <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39686 Reported by: François Bissey Reviewer(s):
This is a follow up to #39251
This PR removes work around to support older python during the last two synchronization of sage_autodoc.py with upstream. python 3.9/3.10 support removal also enable us to move to a newer version of sphinx.
📝 Checklist
⌛ Dependencies