1.19. Downloadable Files

To place a downloadable file in a document, use the download role.

To understand the procedure better, see this
:download:`example script </_downloads/contributing/example_script.py>`.

Downloadable files with a dedicated context to a specific part of the documentation should also be placed exactly at this point in the source tree of the documentation. Other common artefacts should be put in the documentation root or the /_downloads/ subdirectory, and they should be in a subdirectory with the same name as the document in which they appear (that is, the filename without the .rst extension).

Attention

Downloads are not fully supported by all Sphinx builders. Especially offline documents like LaTeX/PDF will be created correctly, but will not provide additional artifacts.

:download:

For more details, see download role.

The example
1
2
3
4
5
6
7
8
All artifacts were selected and download by using this references:

* matplotlib example: |ellipses.py| (published as `ellipses.py`_)

.. |ellipses.py| replace::
   :download:`ellipses.py </_images/mplplots/ellipses.py>`
.. _`ellipses.py`:
   https://matplotlib.org/gallery/shapes_and_collections/ellipse_demo.html#ellipse-rotated
Which gives

All artifacts were selected and download by using this references: