|
| 1 | +Specifying Dependencies |
| 2 | +======================= |
| 3 | + |
| 4 | +Any dependencies required for building a documentation project can be specified using a pip requirements file or a conda environment file. |
| 5 | + |
| 6 | +.. note:: For the purpose of building your documentation with RTD, *project* is the documentation project, and *project root* is the directory where all the documentation is stored, often named ``docs``. |
| 7 | + |
| 8 | +Specifying a requirements file |
| 9 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 10 | + |
| 11 | +The requirements file option is useful for specifying dependencies required for building the documentation. Additional uses specific to Read the Docs are mentioned at the end of this guide. |
| 12 | + |
| 13 | +For details about the purpose of pip requirements file and how to create one, check out `pip user guide`_. |
| 14 | + |
| 15 | +To use the requirements file, create and place the requirements file in the root directory of your documentation directory. For example:: |
| 16 | + |
| 17 | + docs/requirements.txt |
| 18 | + |
| 19 | +Using the YAML configuration file |
| 20 | +--------------------------------- |
| 21 | + |
| 22 | +The recommended approach for specifying a pip requirements file is to use a ``readthedocs.yml`` file. |
| 23 | + |
| 24 | +The file's path should be relative to documentation root. |
| 25 | + |
| 26 | +.. code-block:: yaml |
| 27 | +
|
| 28 | + requirements_file: requirements.txt |
| 29 | +
|
| 30 | +See :doc:`yaml-config` for setting up the .yml file |
| 31 | + |
| 32 | +Using the project admin dashboard |
| 33 | +--------------------------------- |
| 34 | + |
| 35 | +Once the requirements file has been created; |
| 36 | + |
| 37 | +- Login to Read the Docs and go to the project admin dashboard. |
| 38 | +- Go to ``Admin > Advanced Settings > Requirements file``. |
| 39 | +- Specify the path of the requirements file you just created. The path should be relative to the root directory of the documentation project. |
| 40 | + |
| 41 | +Using a conda environment file |
| 42 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 43 | + |
| 44 | +If using conda, the dependencies can be specified in the conda environment file, ``environment.yml`` . |
| 45 | + |
| 46 | +More on Read the Doc's conda support: :doc:`conda` |
| 47 | + |
| 48 | +Working with `conda and environment.yml`_ |
| 49 | + |
| 50 | +.. note:: Conda is only supported via the YAML file. |
| 51 | + |
| 52 | +This conda environment file can be specified in ``readthedocs.yml`` in the ``conda`` block. |
| 53 | + |
| 54 | +.. code-block:: yaml |
| 55 | +
|
| 56 | + conda: |
| 57 | + file: environment.yml |
| 58 | +
|
| 59 | +As before, the path should be relative to the documentation repository root. |
| 60 | + |
| 61 | +.. _`pip user guide`: https://pip.pypa.io/en/stable/user_guide/#requirements-files |
| 62 | +.. _`conda and environment.yml`: https://conda.io/docs/user-guide/tasks/manage-environments.html |
0 commit comments