Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Doc]: Broken intersphinx objects inventory #22601

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

Closed
douglas-raillard-arm opened this issue Mar 4, 2022 · 15 comments
Closed

[Doc]: Broken intersphinx objects inventory #22601

douglas-raillard-arm opened this issue Mar 4, 2022 · 15 comments

Comments

@douglas-raillard-arm
Copy link

Documentation Link

https://matplotlib.org/objects.inv

Problem

The Sphinx inventory used for intersphinx available at https://matplotlib.org/objects.inv is somewhat empty. Inspecting it with sphobjinv convert plain objects.inv gives:

# Sphinx inventory version 2
# Project: Matplotlib landing page
# Version: 
# The remainder of this file is compressed using zlib.
404 std:doc -1 404.html Page Not Found
genindex std:label -1 genindex.html Index
index std:doc -1 index.html Matplotlib
modindex std:label -1 py-modindex.html Module Index
py-modindex std:label -1 py-modindex.html Python Module Index
search std:label -1 search.html Search Page

Suggested improvement

The inventory should contain links for every class so that intersphinx works.

douglas-raillard-arm added a commit to douglas-raillard-arm/lisa that referenced this issue Mar 4, 2022
FIX

Ignore warnings of broken matplotlib's xref when building the
documentation, as they seem to have all started failing:

matplotlib/matplotlib#22601
@douglas-raillard-arm
Copy link
Author

Looking at the JSON output of sphobjinv, it looks like sphinx is having trouble generating any xref that comes from the docstrings somewhat:

   "0" : {
      "dispname" : "Page Not Found",
      "domain" : "std",
      "name" : "404",
      "priority" : "-1",
      "role" : "doc",
      "uri" : "404.html"
   },

The only references it gets are ones that probably come from .rst sources.
The json should have loads of entries like this one:

   "1060" : {
      "dispname" : "-",
      "domain" : "py",
      "name" : "lisa.energy_model.ActiveState",
      "priority" : "1",
      "role" : "class",
      "uri" : "energy_analysis.html#$"
   },

douglas-raillard-arm added a commit to ARM-software/lisa that referenced this issue Mar 4, 2022
FIX

Ignore warnings of broken matplotlib's xref when building the
documentation, as they seem to have all started failing:

matplotlib/matplotlib#22601
@greglucas
Copy link
Contributor

My guess is this is because the base site is a separate sphinx-built landing page and has its own inventory. You likely want to look at the inventory from "/stable", so the intersphinx mapping would look something like this:

'matplotlib': ('https://matplotlib.org/stable/', None)

@timhoffm
Copy link
Member

timhoffm commented Mar 4, 2022

Did https://matplotlib.org/ work before? If so, we should make that work again; probably by replacing the top-level objects.inv by a link.

@douglas-raillard-arm
Copy link
Author

douglas-raillard-arm commented Mar 4, 2022

It used to work, seems to have broken fairly recently (a month or maybe less). Is there another URL that is supposed to be used for intersphinx ?

EDIT: it looks like some people are using https://matplotlib.org/stable/objects.inv, which does provide a working inventory

@tacaswell
Copy link
Member

This is a fallout from:

  1. the move of hosting our main docs to 'matplotlib.org/stable' from 'matplotlib.org/' (which solves the "chimera" problem and lets us have a brochure site independent of the built docs)
  2. the change in how we host the docs (from ghpages fronted by CloudFlare -> DigitalOcean fronted by CloudFlare) which overlays the full brochure site over the github.matplotlib.org repo (which has a lot of re-directs in it) so that the top-level inventory is now the one from the brochure site.

The best path forward is to use https://matplotlib.org/stable/objects.inv (or the version specific urls e.g. https://matplotlib.org/3.5.0/objects.inv ). I'm inclined to not put it back at top-level permanently. I'm not sure how to do this with any sort of notification or brown-out period so it may be best to just pull the bandaid off.

We definitely need to document this someplace, but I am not sure exactly where.

@tacaswell
Copy link
Member

https://github.com/search?o=desc&q=https%3A%2F%2Fmatplotlib.org%2Fobjects.inv&s=indexed&type=Code suggests there are only 39 instances of this on github which seems.....low?

@douglas-raillard-arm
Copy link
Author

I'm inclined to not put it back at top-level permanently

If that's the route taken, I would suggest actually removing the file if possible rather than leaving an almost empty one, at least it will make the error clear and not leave people to wonder if e.g. matplotlib.axes.Axes should be referenced as matplotlib.axes._axes.Axes or similar issues.

tacaswell added a commit to tacaswell/mpl-brochure-site that referenced this issue Mar 4, 2022
xref to matplotlib/matplotlib#22601

Due to the way that we publish the docs now any files from
matplotilb.github.com including the re-direct to the stable inventory.

This has broken users.
@tacaswell
Copy link
Member

@douglas-raillard-arm That is a good point. Thinking about this, making that not happen is easy and that should implicitly restore the re-direct and it is more work to rebreak it....

@QuLogic
Copy link
Member

QuLogic commented Mar 4, 2022

Removing the file from the brochure site stopped the shadowing from the matplotlib.github.com site, so it should be back and working again.

@QuLogic QuLogic closed this as completed Mar 4, 2022
@bskinn
Copy link

bskinn commented Mar 9, 2022

Two cents: Choosing to delete the file at https://matplotlib.org/objects.inv was absolutely the right way to go, versus adding a link/redirect from /objects.inv to /stable/objects.inv

A redirect would at minimum lead to a lot of link redirects for incoming traffic, and possibly have the potential to break the site in funny ways. Far better for a request to /objects.inv to just 404.


The way intersphinx works when forming the URL to insert into built docs, it takes the first item in the intersphinx_mapping tuple value as the base URL for the docset, and then appends the relative URI for the object being cross-referenced to it, as found for that object in its objects.inv entry.

So, if someone sets up their intersphinx_mapping with an entry for "matplotlib": ("https://matplotlib.org/", None), and the inventory is retrieved from .../stable/objects.inv after a redirect, the URLs produced by intersphinx will not include the internal /stable/... they'll be https://matplotlib.org/api/path/to/page.html#anchor.

Currently, it looks like the matplotlib.org site is set up to redirect most things(?) from / to /stable. Thus, an objects.inv redirect would work for now, though introducing a whole bunch of incoming requests needing that redirect. But, it would increase maintenance burden for the site, and also make it brittle against a possible future need for a more complex redirect strategy.

@tacaswell
Copy link
Member

Thank you for the context @bskinn !

@tacaswell
Copy link
Member

We are doing the "redirect" with a symlink so there is no chance sphinx will know. If we were to properly use a 301 will sphinx correctly deal with that?

@tacaswell
Copy link
Member

https://github.com/sphinx-doc/sphinx/blob/fc428ad324ef38402f1e93b38c61cd6348980ed2/sphinx/ext/intersphinx.py#L158-L194 suggests that sphinx can detect if it got moved, but I think we would have to move to re-directs. Now that we are self-hosting I think this is a thing we can actually do @QuLogic ?

@bskinn
Copy link

bskinn commented Mar 10, 2022

We are doing the "redirect" with a symlink so there is no chance sphinx will know. If we were to properly use a 301 will sphinx correctly deal with that?

Looking at _read_from_url(), I would think that as long as requests can tolerate your configuration, Sphinx should be fine with it, too.

@bskinn
Copy link

bskinn commented Mar 10, 2022

I guess, to be clear, @tacaswell, in these last two posts, are you talking about a redirect just for objects.inv? Or redirects for all of the pages based on /, to the real pages based on /stable/?

tacaswell added a commit to tacaswell/matplotlib.github.com that referenced this issue Mar 10, 2022
Per discussion in
matplotlib/matplotlib#22601 (comment)
this is actually breaking builds in subtle very brittle way as the links that
will be generated will be pointing at the top-level files (that are actually
re-directs to /stable).

The second step of this will be to put a 301 redirect into caddy.
tacaswell added a commit to tacaswell/matplotlib.org that referenced this issue Mar 10, 2022
see discussion at
matplotlib/matplotlib#22601 (comment)

This should make sphinx issues warnings that the objects.inv has moved and
generate correct links.
tacaswell added a commit to tacaswell/matplotlib.org that referenced this issue Mar 10, 2022
see discussion at
matplotlib/matplotlib#22601 (comment)

This should make sphinx issues warnings that the objects.inv has moved and
generate correct links.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants