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
Fix autofunction references for sphinx 3.1.1 #19568
Conversation
A change in sphinx version 3.1.1 means that some references like .. autofunction:: sympy.series.order.Order do not work due to the ambiguity between the series function and the series module. The abiguity is resolved by explicitly separating the module and the object: .. autofunction:: sympy.series.order::Order
Unpin the sphinx version from 3.1.0
✅ Hi, I am the SymPy bot (v160). I'm here to help you write a release notes entry. Please read the guide on how to write release notes.
Note: This comment will be updated with the latest check if you edit the pull request. You need to reload the page to see it. Click here to see the pull request description that was parsed.
|
Do we have to do this for every one? I thought it was just the ones that had conflicting names. |
Here I've just made changes to silence the warnings/errors from the build so I haven't changed all of them. Where I have changed them I've mostly just done it for the whole file. There are a lot of conflicting names in sympy:
The ambiguity for series applies to everything in the series package. Same goes for matrices (because we have There aren't many changes in simplify but I think that's because most references use:
The other option is to make more use of currentmodule and related scoping directives but that won't help for cross-referencing. |
Some of these wouldn't need to be changed if we went for #19554 |
I only superficially watched this whole issue and my knowledge of .rst is rather limited. That's why I'm commenting here (but maybe I'm misunderstanding the issue): if there are two syntax choices and one of them is guaranteed to always work, then I'd definitely prefer to have the universal one applied on the whole codebase. |
There is a style guide but it wasn't much help in this particular situation: I tend to agree that we should just make this change throughout the codebase. Here I've just gone for the minimal "make it work" fix so that it can be backported to 1.6.1 as well. |
Also using currentmodule works and is less verbose. That could be used instead of having |
Yes, sorry if my comment was formulated a bit provocatively. I know and appreciate the style guide! But for small edits I often find myself lazily copying what I see. (I do check the actual html output though before pushing.) |
I agree with this. However, I'm not yet convinced that this isn't just a Sphinx bug (sphinx-doc/sphinx#7841). To me, it should be sufficient to use the right "auto" directive ( If Sphinx doesn't change and the colons remain required, then I we should update the style guide to indicate that's what should be used. |
I see. I thought it was only functions and modules with the same name that caused the problem, which is why I was confused to see things like |
The issue is not which directive you use. If you use
then sphinx understands that At the same time sympy's imports are a mess and it would be better if we didn't have so many conflicting names. Many of these conflicts are due to the deprecated imports which we could remove. For example the only reason that matrices is a problem is because We can just remove those (#19554). That wouldn't fix the whole problem though as you can see from the build failure there: Most of the remaining problems after #19554 are to do with
and |
It's okay for a submodule to have the same name as a parent module provided we don't import that submodule under the same name into the grand-parent module. The same goes for having a function that has the same name as its module. The problem begins when the parent package's
Normally a relative import like this assigns the imported series module (".series") as an attribute of the current module but here it gets overwritten by the series function imported from that mdoule instead. Before sympy 1.6 the main |
I guess there really is an ambiguity on Sphinx's side, since dots can also refer to attributes (e.g., But if after removing the deprecation stuff we don't need any colons, then I don't think we need to worry about it. Otherwise, I think we should note it in the style guide as something that is needed in some cases to remove ambiguity. We already note that in some instances you have to have a fully qualified name in a cross-reference (https://docs.sympy.org/latest/documentation-style-guide.html#cross-referencing). I see this as similar to that. |
Codecov Report
@@ Coverage Diff @@
## master #19568 +/- ##
=============================================
+ Coverage 75.652% 75.668% +0.016%
=============================================
Files 654 654
Lines 169941 169941
Branches 40065 40065
=============================================
+ Hits 128564 128592 +28
+ Misses 35764 35737 -27
+ Partials 5613 5612 -1 |
References to other Issues or PRs
This is a fix for #19551 on master but it should also be cherrypicked for 1.6.1
Brief description of what is fixed or changed
Other comments
Release Notes
NO ENTRY