Skip to content

Add guide for requirements from #3636 #4212

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 3 commits into from
Jun 15, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ are `numpydoc <https://github.com/numpy/numpydoc>`_ and
output more closely matches the format of standard Sphinx annotations,
and as a result, it tends to look a bit better with the default theme.

.. _faq_document_package_not_at_root:

Can I document a python package that is not at the root of my repository?
-------------------------------------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions docs/guides/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ These guides will help walk you through the usage of Read the Docs.


.. toctree::
:maxdepth: 1
:glob:

*
67 changes: 67 additions & 0 deletions docs/guides/specifying-dependencies.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
Specifying Dependencies
=======================

Any dependencies required for building a documentation project can be specified using a pip requirements file or a conda environment file.

.. 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``.

Specifying a requirements file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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.

For details about the purpose of pip requirements file and how to create one, check out `pip user guide`_

To use the requirements file, create and place the requirements file in the root directory of your documentation directory. For example::

docs/requirements.txt

Using the YAML configuration file
---------------------------------
The recommended approach for specifying a pip requirements file is to use a readthedocs.yml file.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use `readthedocs.yml` here (quotes for code)


The file's path should be relative to documentation root.

.. code-block:: yaml

requirements_file: requirements.txt

See :doc:`yaml-config` for setting up the .yml file

Using the project admin dashboard
---------------------------------

Once the requirements file has been created;

- Login to Read the Docs and go to the project admin dashboard.
- Go to ``Admin > Advanced Settings > Requirements file``.
- Specify the path of the requirements file you just created. The path should be relative to the root directory of the documentation project.

Using a conda environment file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If using conda, the dependencies can be specified in the conda environment file, ``environment.yml`` .

More on Read the Doc's conda support: :doc:`conda`

Working with `conda and environment.yml`_

.. note:: Conda is only supported via the YAML file.

This conda environment file can be specified in ``readthedocs.yml`` in the ``conda`` block.

.. code-block:: yaml

conda:
file: environment.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some weird spaces here: probably tabs mixed with spaces.


As before, the path should be relative to the documentation repository root.

Additional Uses
~~~~~~~~~~~~~~~
- Documenting multiple packages
- setup.py not in root directory
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand this section. I think it would be better if an introduction paragraph is added instead of just a two item list with a link.


See :ref:`faq_document_package_not_at_root`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use the autosectionlabel feature here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too concerned with the content, I'm not that author here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with Santos here so we have most of our docs using the same pattern. The ref would look like:

:ref:`faq:Can I document a python package that is not at the root of my repository?`



.. _`pip user guide`: : https://pip.pypa.io/en/stable/user_guide/#requirements-files
.. _`conda and environment.yml`: : https://conda.io/docs/user-guide/tasks/manage-environments.html
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these : duplicated here?