If the repo is missing a .readthedocs.yml you’ll want to make a new one. Use this example as a starting point:
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required: the version of this file's schema.
# Build documentation in the docs/ directory with Sphinx
# Optionally build your docs in additional formats such as PDF
# Optionally set the version of Python and requirements required to build your docs
- requirements: requirements/doc.txt
Follow the directions from the Go to the build output section to go to your repos ReadTheDocs project page.
Go to the Builds page for your project and build the latest version of the docs. (This will pull all the latest code including any new branches).
Go to the Versions page for your project.
Under the Activate a Version section, find the name of your PR branch.
Click Activate on your PR branch.
Set your branch to be active (it will be built) and hidden (it won’t be listed in the versions list) and then save the changes.
Now you should be able to run builds of your branch to test any changes you’re making to the .readthedocs.yml file.
Go back to the Builds screen and build your branch as many times as you need while you iterate on changes.
When you’re done testing, de-activate your branch on the Versions page.
Common Documentation Building Problems
Wrong Python Version on RTD
If RTD is trying to build the docs using an older version of Python (2.x) you can update that version.
If your repo has a .readthedocs.yml, update the Python version in that file and push up a new PR.
If it is still configured via the web interface, consider moving your settings to .readthedocs.yml as a part of the fix. You can also update the setting in the web interface by going to ‘Admin’->'Advanced Settings' and try to re-build the project.
Missing Requirements Files
If you see a ‘No such file or directory’ message on the requirements file, the issue might be with the config in your repo.
If your repo has a .readthedocs.yml, ensure that the correct path to the requirements file is in there.
If it is still configured via the web interface, consider moving your settings to .readthedocs.yml as a part of the fix. You can also update the setting in the web interface by going to ‘Admin’->'Advanced Settings' to put in the correct path to the requirements file needed to build the docs.
The docs might build fine when triggered manually, but not start builds automatically. This means you need to add or fix the webhook:
Visit the Admin - Integrations section of the project dashboard
You need a “GitHub incoming webhook.” If it’s not there, click “Add integration.”
Select “GitHub incoming webhook” from the Integration type dropdown.
ReadTheDocs will try to add the webhook to GitHub, but will likely fail (TODO: why?)
Copy the URL that starts “readthedocs.org/api/v2/…”
In GitHub, go to the repo Settings - Webhooks. Click “Add webhook”
Paste the URL you copied into the Payload URL. Make sure it starts with “https://”
Choose “Let me select individual events” then choose these events: