readthedocs-write-config
Write Read the Docs config (v2)
Overview
Write or revise .readthedocs.yaml files for Read the Docs v2 builds. Focus on required fields, correct paths, and supported keys to avoid validation failures.
Workflow
-
Identify the documentation tool and paths.
- Confirm whether the project uses Sphinx, MkDocs, or something else.
- Collect
sphinx.configuration(conf.py) ormkdocs.configuration(mkdocs.yml) paths. - Confirm the config file location (repo root by default, subdirectory for monorepos).
-
Choose the build image and tools.
- Set
build.osandbuild.toolswhen using custom build jobs or commands. - Choose stable versions; use
latestonly when asked.
- Set
-
Define dependency installation.
- Use
python.installwith requirements and/or package install. - Use
conda.environmentwhen the project uses conda, and setbuild.tools.pythonaccordingly.
- Use
-
Configure the build step.
- Use
sphinxormkdocssettings for standard builds. - Prefer
build.jobsfor customization; usebuild.commandsonly to fully replace the pipeline. - If overriding formats, write outputs under
$READTHEDOCS_OUTPUT/<format>/.
- Use
-
Add optional settings.
- Set
formatsfor extra outputs (Sphinx only). - Configure
submodulesorsearchonly if requested.
- Set
-
Validate against supported keys and required fields.
- Use
references/v2-config.mdto confirm defaults, allowed values, and constraints.
- Use
Quick start templates
- For Sphinx, start from
assets/sphinx.readthedocs.yaml. - For MkDocs, start from
assets/mkdocs.readthedocs.yaml.
Decision notes
- Prefer
build.jobsoverbuild.commandsbecause it preserves standard steps and supports per-format commands. - Avoid
build.apt_packageswhen usingbuild.commands(not supported together). - Include
formatsonly when the user needs PDF/ePub/HTMLZIP output. - Do not combine
submodules.includeandsubmodules.exclude.
Output checklist
version: 2present.build.osandbuild.toolspresent when required.sphinx.configurationormkdocs.configurationpath is correct.- All custom build outputs are written to
$READTHEDOCS_OUTPUT. - No unsupported keys or typos.
Resources
- Reference:
references/v2-config.md - Templates:
assets/sphinx.readthedocs.yaml,assets/mkdocs.readthedocs.yaml
Docs
More from readthedocs/skills
readthedocs-search-api
Query the Read the Docs Search API to find documentation across projects and repositories. Use when searching documentation, finding related docs, finding API documentation, or gathering information about projects on Read the Docs.
16readthedocs-api
Full Read the Docs API v3 client guidance. Use when building or updating an API client, generating requests, or answering questions about Read the Docs API v3 endpoints (projects, versions, builds, subprojects, translations, redirects, environment variables, organizations, remote VCS resources, or embed content).
15readthedocs-redirects-manager
Manage Read the Docs redirects via the RTD API. Use when listing, creating, updating, or deleting custom redirects for a project.
12readthedocs-build-failure-triage
Triage Read the Docs build failures using build logs and config context. Use when a build fails, logs need analysis, or you need fix recommendations.
12readthedocs-project-manager
Manage Read the Docs projects via the RTD API. Use when creating projects, listing repos, triggering builds, syncing versions, or checking build status on Read the Docs.
11readthedocs-build-optimization
Optimize Read the Docs build performance and resource usage. Use when Read the Docs builds are slow, timing out, or hitting memory limits, or when users want to speed up builds by adjusting formats, dependencies, conda/mamba usage, or Python API documentation strategy.
7