Build process¶
Once a project has been imported and a build is triggered, Read the Docs executes specific pre-defined jobs to build the project’s documentation and update the hosted content. This page explains in detail what happens behind the scenes, and an overview of how you can change this process.
Understanding what’s going on¶
Understanding how your content is built helps with debugging the problems that may appear in the process. It also allows you customize the steps of the build process.
Note
All the steps are run inside a Docker container with the image the project defines in build.os.
The following are the pre-defined jobs executed by Read the Docs:
- checkout
Checks out project’s code from the URL’s repository defined for this project. It will use
git clone
,hg clone
, etc depending on the version control system you choose.- system_dependencies
Installs operating system & system-level dependencies. This includes specific version of languages (e.g. Python, Node.js, Go, Rust) and also
apt
packages.At this point, build.tools can be used to define a language version, and build.apt_packages to define
apt
packages.- create_environment
Creates a Python environment to install all the dependencies in an isolated and reproducible way. Depending on what’s defined by the project a virtualenv or a conda environment (conda) will be used.
- install
Install default common dependencies.
If the project has extra Python requirements, python.install can be used to specify them.
Tip
We strongly recommend pinning all the versions required to build the documentation to avoid unexpected build errors.
- build
Runs the main command to build the documentation for each of the formats declared (formats). It will use Sphinx (sphinx) or MkDocs (mkdocs) depending on the project.
- upload
Once the build process finishes successfully, the resulting artifacts are uploaded to our servers, and the CDN is purged so the newer version of the documentation is served.
See also
If there are extra steps required to build the documentation, or you need to execute additional commands to integrate with other tools, it’s possible to run user-defined commands and customize the build process.
Build resources¶
Every build has limited resources to avoid misuse of the platform. Currently, these build limits are:
15 minutes build time
3GB of memory
2 concurrent builds
We can increase build limits on a per-project basis. Send an email to support@readthedocs.org providing a good reason why your documentation needs more resources.
If your business is hitting build limits hosting documentation on Read the Docs, please consider Read the Docs for Business which has much higher build resources.
30 minutes build time
7GB of memory
Concurrent builds vary based on your pricing plan
If you are having trouble with your documentation builds, you can reach our support at support@readthedocs.com.
Default environment variables¶
The Read the Docs builder sets the following environment variables when building your documentation:
Environment variable |
Description |
Example value |
---|---|---|
|
Whether the build is running inside RTD |
|
|
The RTD slug of the version which is being built |
|
|
Corresponding version name as displayed in RTD’s version switch menu |
|
|
Type of the event triggering the build |
|
|
The RTD slug of the project which is being built |
|
|
The RTD language slug of the project which is being built |
|
Note
The term slug is used to refer to a unique string across projects/versions containing ASCII characters only. This value is used in the URLs of your documentation.
Tip
If extra environment variables are needed in the build process (like an API token), you can add them going to Admin > Environment Variables in your project. See Environment Variables.