Skip to content

Conversation

@AA-Turner
Copy link
Member

Purpose

I am frequently in situations with a poor internet connection, or entirely offline for brief periods. I also frequently rebuild with --fresh-env to 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.inv files. It is used when all of the following criteria are met:

  • The inventory location is a URL, not a local file,
  • The inventory has not already been cached in the environment,
  • The local cache file exists, and
  • The local cache file is not older than the cache expiry time

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

  • None.

@AA-Turner AA-Turner merged commit b9641ae into sphinx-doc:master Jun 22, 2025
28 checks passed
@AA-Turner AA-Turner deleted the intersphinx/cache-inventory branch June 22, 2025 01:08
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 29, 2025
@AA-Turner AA-Turner added this to the 9.0.0 milestone Nov 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant