Subclasses of Polygon with numpydoc xref throws error b/c of CapStyle, JoinStyle #19839
Comments
Umm, how did we end up with private libraries linked in the public docs? That shouldn't have happened. https://matplotlib.org/stable/api/_enums_api.html#matplotlib._enums.CapStyle I think @brunobeltran and @timhoffm worked on this? |
The use of private modules is a workaround. The classes themselves are not public, but the concepts they describe are. We need a location to document these concepts and the simplest solution is with the classes that represent these concepts. There are other ways to solve this as I've proposed in #18544, but that would require additional machinery and was not appreciated in that discussion. as for the xref thing, I do not fully understand where the warning is coming from and need to have a closer look. |
As far as I can tell, the xref issue stems from the fact that references to |
- Temporary fix to matplotlib/matplotlib#19839, - from astropy#11118, - closes (?) astropy#11464 Co-authored-by: @pllim Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
- Temporary fix to matplotlib/matplotlib#19839, - from astropy#11118, - closes (?) astropy#11464 Co-authored-by: @pllim Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
- Temporary fix to matplotlib/matplotlib#19839, - from astropy#11118, - closes (?) astropy#11464 Co-authored-by: @pllim Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
Circling back here... The patch suggested above did get around the ReadTheDocs "fail on warning" problem; see astropy/astropy#11466 though you still see those warnings in the log but they somehow not blocking RTD check. FYI And for completeness: xref astropy/astropy#11458 |
I think this may be related to sphinx-doc/sphinx#6211 (which I basically opened based on my experience with matplotlib)? |
I am bit confused why this specific dotted reference breaks your build whereas a lot of other dotted references (e.g. |
@anntzer , these are the warnings (it breaks because we have RTD set to fail on warning):
The code in References: astropy/astropy#11458 astropy/sphinx-automodapi#125 |
I'm now confused: Are you breaking because of the deprecation warnings or because of "reference target not found" in the first comment above? Or both? |
Originally it was both, but we monkey-patched a solution to the "reference target not found" error by editing the matplotlib docstrings before subclassing Polygon (https://github.com/astropy/astropy/pull/11466/files, but PR is incorrectly named for what it solves). |
It is presumably still an error if the monkey-patch is removed. |
In the dev call today, we decided to replace the types (specifically CapStyle) by plain references, i.e.
to
These should be resolved via intersphinx so that the monkey-patching becomes obsolete. The deprecation warning is a separate topic, I'll reopen #19850. |
@nstarman , suggestion from #19850 (comment) is a no-go, so I think the monkeypatch is there to stay until |
@pllim @nstarman AFAICT these two issues are completely unrelated. The planned change here (#19839 (comment)) should make the monkey-patching obsolete. |
I can't say I understand what's going on either. RTD passes with the monkey patch. Maybe the warning is red herring after all. 🤷🏻♀️ |
- Temporary fix to matplotlib/matplotlib#19839, - from astropy#11118, - closes (?) astropy#11464 Co-authored-by: @pllim Signed-off-by: Nathaniel Starkman (@nstarman) <nstarkman@protonmail.com>
Problem
The sphinx links to
CapStyle
andJoinStyle
in v3.4.0 are relative to the file, so a subclass ofmatplotlib.patches.Patch
in a package with numpydoc xref (https://numpydoc.readthedocs.io/en/latest/install.html) turned on cannot link to the objects and errors with.WARNING: py:obj reference target not found: CapStyle
WARNING: py:obj reference target not found: JoinStyle
https://matplotlib.org/stable/api/_as_gen/matplotlib.patches.Patch.html#matplotlib.patches.Patch.set_capstyle
https://matplotlib.org/stable/api/_as_gen/matplotlib.patches.Patch.html#matplotlib.patches.Patch.set_joinstyle
Edit:
The problem also appears to involve
Patches.__init__
. I can monkey-patch a fix withSuggested Improvement
Matplotlib version
The text was updated successfully, but these errors were encountered: