|
| 1 | +.. post:: May 19, 2021 |
| 2 | + :tags: feature, builders |
| 3 | + :author: Juan Luis |
| 4 | + :location: MAD |
| 5 | + |
| 6 | +.. meta:: |
| 7 | + :description lang=en: |
| 8 | + We have deployed a long awaited feature: |
| 9 | + the ability to install custom operating system packages. |
| 10 | + |
| 11 | +Install custom operating system packages (apt) |
| 12 | +============================================== |
| 13 | + |
| 14 | +We are thrilled to announce that now Read the Docs users |
| 15 | +can declare custom operating system packages in their project configuration |
| 16 | +that will get installed in our Ubuntu-based builders using ``apt``. |
| 17 | +This has been a long awaited feature, |
| 18 | +and we think it will simplify the configuration of many projects, |
| 19 | +especially scientific ones. |
| 20 | + |
| 21 | +Previous solutions |
| 22 | +------------------ |
| 23 | + |
| 24 | +The Ubuntu images used by our builders |
| 25 | +contain `lots of preinstalled system |
| 26 | +packages <https://github.com/readthedocs/readthedocs-docker-images/blob/8e4f035c219307e30f5e3326c3c8271cee4f2631/Dockerfile#L15-L131>`_ |
| 27 | +that we ship to all the projects |
| 28 | +to make the most common use cases possible. |
| 29 | +This includes compilers, development headers of common libraries, and others. |
| 30 | + |
| 31 | +However, on one hand this makes our images way bigger than necessary, |
| 32 | +and it is still not enough to solve 100 % of the use cases. |
| 33 | +Fortunately, Read the Docs has supported the `conda package |
| 34 | +manager <https://docs.readthedocs.io/en/stable/guides/conda.html>`_ |
| 35 | +for a long time already, |
| 36 | +and this has allowed users with special needs to add |
| 37 | +any non-Python libraries they needed. |
| 38 | +Still, interoperability between conda and pip is not perfect, |
| 39 | +and for users that are not used to conda this could feel like a hack. |
| 40 | + |
| 41 | +New ``apt_packages`` configuration |
| 42 | +---------------------------------- |
| 43 | + |
| 44 | +To overcome all these problems, we have added a new configuration value, |
| 45 | +``build.apt_packages``, that receive a list of APT packages |
| 46 | +that will be installed in our Ubuntu-based images. |
| 47 | +`Our configuration |
| 48 | +documentation <https://docs.readthedocs.io/en/stable/config-file/v2.html#build-apt-packages>`_ |
| 49 | +contains a simple example: |
| 50 | + |
| 51 | +.. code-block:: yaml |
| 52 | +
|
| 53 | + build: |
| 54 | + image: latest |
| 55 | + apt_packages: |
| 56 | + - libclang |
| 57 | + - cmake |
| 58 | +
|
| 59 | +(Notice that at the moment our images are based Ubuntu 18.04, |
| 60 | +this will change in the near future) |
| 61 | + |
| 62 | +And you can draw inspiration from some community projects that are using this feature already: |
| 63 | + |
| 64 | +- `geoserver-rest`_, a Python library to interact with GeoServer, uses `apt_packages` |
| 65 | + to `install some GDAL and pycurl |
| 66 | + dependencies <https://github.com/gicait/geoserver-rest/blob/70ec799937b18ec7baed6fd3f7b2bf2f11dd8237/.readthedocs.yaml#L3-L12>`_. |
| 67 | +- `UCX-Py`_, a Python interface for the low-level networking library UCX, |
| 68 | + `installs extra dependencies to temporarily work around upstream |
| 69 | + issues <https://github.com/rapidsai/ucx-py/blob/504ba8efecafaf48b5a2692113b8da70f8229721/.readthedocs.yml#L3-L6>`_. |
| 70 | + |
| 71 | +We are happy that this feature is already being used |
| 72 | +minutes after being deployed |
| 73 | +and are looking forward to seeing more projects make use of it. |
| 74 | + |
| 75 | +Remember you can always see the latest changes to our platforms in our `Read the Docs |
| 76 | +Changelog <https://docs.readthedocs.io/page/changelog.html>`_ and `Ethical Ad Server |
| 77 | +Changelog <https://ethical-ad-server.readthedocs.io/page/developer/changelog.html>`_. |
| 78 | + |
| 79 | +Considering using Read the Docs for your next Sphinx or MkDocs project? |
| 80 | +Check out `our documentation <https://docs.readthedocs.io/>`_ to get started! |
| 81 | + |
| 82 | +.. _geoserver-rest: https://geoserver-rest.readthedocs.io/ |
| 83 | +.. _UCX-Py: https://ucx-py.readthedocs.io/ |
0 commit comments