[openstack-dev] [Sphinx] [ReadTheDocs] How to change the default Sphinx theme in a docs gate job?

Doug Hellmann doug at doughellmann.com
Mon Jan 12 18:11:09 UTC 2015


> On Jan 12, 2015, at 6:25 AM, Mikhail Dubov <mdubov at mirantis.com> wrote:
> 
> Hi all,
> 
> when it gets to submitting & reviewing patches for the project documentation, it is very convenient to surf through the docs generated by Sphinx in a special Gate job. The problem is that Sphinx uses in gates a theme which is different from that used on ReadTheDocs. So the docs generated in gates look differently from the docs that we have on ReadTheDocs, while the desired behaviour is to have the same Sphinx theme both on ReadTheDocs and in gates.
> 
> There is a snippet <http://read-the-docs.readthedocs.org/en/latest/theme.html> that enables the default ReadTheDocs theme locally (and also potentially in gates):
> # on_rtd is whether we are on readthedocs.org <http://readthedocs.org/>
> import os
> on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
> 
> if not on_rtd:  # only import and set the theme if we're building docs locally
>     import sphinx_rtd_theme
>     html_theme = 'sphinx_rtd_theme'
>     html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
> 
> # otherwise, readthedocs.org <http://readthedocs.org/> uses their theme by default, so no need to specify it
> The problem is that it uses the sphinx_rtd_theme <https://pypi.python.org/pypi/sphinx_rtd_theme> python package, which is not included in the global requirements. What should be done then to enable that default ReadTheDocs theme in gates?
> 
> 
> Best regards,
> Mikhail Dubov
> 
> Engineering OPS
> Mirantis, Inc.
> E-Mail: mdubov at mirantis.com <mailto:mdubov at mirantis.com>
> Skype: msdubov
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

It should be possible to simply add the dependency to the list of requirements for the docs job, in test-requirements.txt. I see you’ve done that in https://review.openstack.org/#/c/120018/ <https://review.openstack.org/#/c/120018/> and it appears to be working for the docs build itself. Are the other failures on that job related to the new dependency?

Doug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150112/15353534/attachment.html>


More information about the OpenStack-dev mailing list