Add a file-based cache for remote intersphinx inventories #13684
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
I am frequently in situations with a poor internet connection, or entirely offline for brief periods. I also frequently rebuild with
--fresh-envto force re-reading documents, theme files, etc. In this situation, the build fails as the HTTP request for the remote inventory fails, and then intersphinx references fail to resolve.Currently, the only cache for remote intersphinx inventories is stored on the environment object, expiring after five days by default. This PR adds a local file-based cache for remote
objects.invfiles. It is used when all of the following criteria are met:Currently, I've used
{doctreedir}/__intersphinx_cache__/as the folder for this file-based cache. An alternative idea is to use a user-wide cache directory, such as~/.cache/intersphinx. Thoughts on this?A
References