readthedocs.yaml config version 2 vs. RTD build fleet: default image and interpreter resolution when build.os and build.tools.python are omitted
0 reputation · 16 Jan 2024, 12:10 UTC
0 reputation · 16 Jan 2024, 12:10 UTC
A repository's readthedocs.yaml (config version 2) and Read the Docs' build fleet form the primary integration boundary for documentation builds. The build.os and build.tools.python keys explicitly select the container image (Ubuntu release) and Python interpreter, but both are optional.
When these keys are omitted, RTD applies a default image that has changed across releases — older Ubuntu images have been retired. The exact default Python version and the current supported build.os values are not guaranteed to remain stable over time, and the .org versus .com hosting tiers may differ in their default selections.
Determine the precise resolution logic RTD uses for the build environment when a project leaves build.os and build.tools.python unpinned, and whether that logic is documented or observable only through build logs.
Does RTD publish a versioned mapping of default image to interpreter for each config version? Can a project detect the resolved image and interpreter programmatically during a build? Is the default selection consistent between readthedocs.org and readthedocs.com for the same config?
35275 reputation · 16 Jan 2024, 17:33 UTC
When build.os and build.tools.python are omitted in a config-version-2 readthedocs.yaml, Read the Docs (RTD) applies an internal, version-specific mapping to choose a container image and Python interpreter. The exact mapping is not published as a stable, versioned API, and it can change as RTD retires old images. The resolved values are observable in build logs and, in many cases, through build environment variables.
readthedocs.org and readthedocs.com, and the paid tier may offer additional overrides through its web UI.Based on RTD's build-fleet history, the current default for config v2 is typically Ubuntu 22.04 LTS, with the interpreter set to the latest stable Python 3 release available on that image (often Python 3.10 or 3.11). These are operational observations, not contractual guarantees, and RTD may update them without notice.
You can confirm the resolved image and interpreter by inspecting the first lines of a build log. Within the build, you can also print environment variables that RTD sets, if present:
echo $READTHEDOCS_OS
echo $READTHEDOCS_PYTHON
If those variables are absent, parse the log for the image tag and Python version string.
readthedocs.yaml so it omits build.os and build.tools.python.echo $READTHEDOCS_OS $READTHEDOCS_PYTHON to a build step or documentation script to print the resolved values.readthedocs.org and readthedocs.com, compare the logs to detect tier-specific differences.Are you building on the free readthedocs.org tier or on a paid readthedocs.com account? This determines whether tier-specific default images apply and whether web UI overrides are available.
If your documentation build depends on a specific Python version or OS behavior, explicitly pin build.os and build.tools.python in readthedocs.yaml. Relying on defaults risks silent breakage when RTD updates its build fleet.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.