-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Docs: Configuration file pages as explanation and reference (Diátaxis) #10416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
096e292
Scissor out and refine changes from #9921
benjaoming c727927
Polish intro sentences
benjaoming 62e1e2c
Merge branch 'main' of github.com:readthedocs/readthedocs.org into do…
benjaoming 59d431d
Add how-to reference
benjaoming 63680bc
Do some content updates.
ericholscher d0ec911
Emoji ⚖️
benjaoming 5a0dc88
fix mini err
benjaoming 5feb0ff
typo fix
benjaoming 9c3d112
typo fixes
benjaoming ef720d9
Adds a seealso to v2 reference -- many people are visiting the refere…
benjaoming File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,119 @@ | ||
Configuration file | ||
================== | ||
Using a configuration file | ||
========================== | ||
|
||
In addition to using the admin panel of your project to configure your project, | ||
you can use a configuration file in the root of your project. | ||
The configuration file should be named ``.readthedocs.yaml``. | ||
The lifecycle of a documentation project changes both the content and the structure of the documentation. | ||
In addition to this, | ||
**the whole configuration of a project also changes**. | ||
|
||
.. note:: | ||
In this article, | ||
we cover the major concepts that are applied in our configuration file: | ||
|
||
Some other variants like ``readthedocs.yaml``, ``.readthedocs.yml``, etc | ||
are deprecated. | ||
Versioning the configuration | ||
When the documentation project changes, | ||
its configuration often changes alongside. | ||
|
||
Configuration as code | ||
A commonly used term which is good to know the background and meaning of. | ||
|
||
Options that are **not** found in the configuration file | ||
Not everything is suitable for *configuration as code*. | ||
|
||
.. TODO: Add upcoming configuration file how-to | ||
|
||
.. seealso:: | ||
|
||
:doc:`/config-file/v2` | ||
Reference of all the settings offered in the build configuration file. | ||
|
||
Why version your project's configuration? | ||
----------------------------------------- | ||
|
||
Consider the following aspects of a documentation project: | ||
|
||
Build environments change 📦️ | ||
You may depend on a number of packages but your method for installing them changes. | ||
What is installed, how it's installed and what installs it can change. | ||
|
||
For instance, | ||
you might change between Pip, Pipenv, Conda etc. | ||
You might also jump between Python 2 and 3 or Python 3.8 and Python 3.10. | ||
|
||
Documentation tool setups change ⚙️ | ||
Using Sphinx? Using MkDocs? Or some other tool? | ||
All these tools have their own configuration files and special ways to invoke them. | ||
In order to switch between how you are invoking the tool and setting up its environment, | ||
you will need external build configuration. | ||
|
||
Switching documentation tools 💣️ | ||
Long-lived software projects can go through many phases in their history. | ||
This includes changing the documentation tool. | ||
|
||
|
||
You can configure your Read the Docs project by adding a special file ``.readthedocs.yaml`` [1]_ to your Git repository. | ||
|
||
Because the file is stored in Git, | ||
the configuration will apply to the exact version that is being built. | ||
This allows you to store different configurations for different versions of your documentation. | ||
|
||
The main advantages of using a configuration file over the web interface are: | ||
|
||
- Settings are per version rather than per project. | ||
- Settings live in your VCS. | ||
- Settings live in your Git repository. | ||
- They enable reproducible build environments over time. | ||
- Some settings are only available using a configuration file | ||
|
||
.. tip:: | ||
.. [1] Other variants of the configuration file name like ``readthedocs.yaml``, ``.readthedocs.yml``, etc. are deprecated. | ||
You may however, :doc:`configure a custom sub-folder </guides/setup/monorepo>`. | ||
|
||
Configuration as Code | ||
--------------------- | ||
|
||
"Configuration as Code" is a concept whereby the configuration or settings of software is maintained in a Git repository as *code*. | ||
Alternatively, configurations are often added and managed inside the software's own UI, | ||
making it hard to track changes, and reproduce and copy behavior to other projects. | ||
|
||
Most users of Read the Docs will already be familiar with the concept since many popular tools already require you to store their configuration in your Git repository: | ||
|
||
* Sphinx uses a ``conf.py`` file. | ||
* MkDocs uses a ``mkdocs.yaml`` file. | ||
* Python projects in general have a ``requirements.txt`` or similar. | ||
|
||
Because of its fragility and uniqueness, | ||
the alternative to "Configuration as Code" is also often referred to as snowflake ❄️ configuration. | ||
Such configurations are hard to copy between projects and also hard to introspect for people without authorization to access the configuration UI. | ||
|
||
|
||
Expressing a configuration *as code* is therefore considered by many to be the easier option. | ||
It might seem harder to have to write the configuration code from scratch, | ||
but in order to use Read the Docs, | ||
you can usually start by copy-pasting a template and adapting it. | ||
|
||
Read the Docs has chosen to offer as much configuration as possible through the usage of ``.readthedocs.yaml``. | ||
Our experience is that projects benefit from such a setup, | ||
and even when the benefits aren't obvious in the beginning of a project's lifecycle, | ||
they will emerge over time. | ||
|
||
What's not covered by ``.readthedocs.yaml``? | ||
-------------------------------------------- | ||
|
||
There are a number of things that aren't possible to cover in the configuration file, | ||
which still belong in your project's Dashboard. | ||
|
||
These configuration items are for instance: | ||
|
||
Git settings | ||
Since the configuration file is stored in Git, | ||
it doesn't make sense that it would configure the Git setup. | ||
|
||
Custom domains and redirects | ||
Settings | ||
|
||
Using a configuration file is the recommended way of using Read the Docs. | ||
Other general non-versioned settings | ||
In general, | ||
settings that aren't versioned and do not relate to how your project is built are accessed via your :term:`dashboard`. | ||
|
||
.. toctree:: | ||
:maxdepth: 3 | ||
.. seealso:: | ||
|
||
Version 2 <v2> | ||
:doc:`/guides/reproducible-builds` | ||
In addition to storing your configuration in Git, | ||
we also recommend special practices for making your builds resilient to changes in your software dependencies. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Deep dive into Read the Docs | ||
============================ | ||
|
||
In this section, | ||
we explain some of the more specific or advanced concepts of writing documentation on Read the Docs. | ||
|
||
⏩️ :doc:`/config-file/index` | ||
The lifecycle of a documentation project changes the content and the structure of the documentation. | ||
In addition to this, | ||
the whole configuration of a project also changes. | ||
In this article, | ||
we explain some of the fundamental purposes of having a configuration file. | ||
|
||
⏩️ :doc:`/subprojects` | ||
Thinking about gathering several documentation projects under the same umbrella? | ||
This is a common need, and using *subprojects* is a flexible option that is recommended for most cases. | ||
|
||
⏩️ :doc:`/localization` | ||
Learn more about multilingual documentation projects and how translation workflows are supported. | ||
|
||
⏩️ :doc:`/downloadable-documentation` | ||
An introduction to adding downloadable files that can be read offline to your documentation and keep them versioned. | ||
|
||
⏩️ :doc:`/environment-variables` | ||
Environment variables can be used to make your documentation builds flexible and easy to customize. | ||
This is a general introduction to environment variables on our platform, both pre-defined and custom environment variables. | ||
|
||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:hidden: | ||
|
||
/config-file/index | ||
benjaoming marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/subprojects | ||
/localization | ||
/downloadable-documentation | ||
/environment-variables |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.