-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Docs: install theme as Sphinx extension may not be required #1222
Comments
It's not just localisation, it's also a few other compatibility shims: https://github.com/readthedocs/sphinx_rtd_theme/blob/73d1707/sphinx_rtd_theme/__init__.py#L51-L61. But yes, strictly speaking, most of the theme will work w/o loading the extension because it's also declared as an entry point: https://github.com/readthedocs/sphinx_rtd_theme/blob/73d1707/setup.py#L116. |
I'm not 100% sure what it means the theme is declared as an entry point. Can you expand on that? What's the difference between the entry point and add it as an installed extension? |
|
I will note that specifying the theme in Themes are loaded as extensions to execute everything in the theme's Also also, not all projects have or need a So for that, I think the current directions are probably still best. The note on translations is very confusing and probably unnecessary though. |
I don't think projects need these files. We mentioned them because the theme declares itself as an entry point as the official Sphinx documentation mentions. If adding the theme as extension is not required, I would remove it from the documentation since it just adds an extra step for no reason. |
I don't 100% understand the Sphinx internals, but it seems we cannot remove the installation as an extension: #1434 (comment). We would need more research and test if we want to move forward with this. |
@humitos there are two ways for a theme to get registered in Sphinx. A project containing a theme may contain an extension entry-point function ( I saw themes different things. In my opinion, the most straightforward way is to use entry points for making the theme discoverable and optionally the extension entry point for handling the assets. So the end-users would just have to add one or two lines to their config and that's it. |
This is how we are registering ours and it's what Sphinx says in their theme development documentation. That's why I think that added the theme as an extension is not required and I wanted to remove that extra step. However, based on the user comment that I linked in my previous comment, it seems that our jquery setup is not executed when the theme is not defined as a Sphinx extension. I'd be really good if we can test these difference scenarios and arrive at a conclusion that works for all these scenarios. |
This makes the importable discoverable: https://github.com/readthedocs/sphinx_rtd_theme/blob/2c19bb1/setup.cfg#L62-L64. And this https://github.com/readthedocs/sphinx_rtd_theme/blob/2c19bb1/sphinx_rtd_theme/__init__.py#L73 adds the template path. This is what activates |
Good point. This a good thing to test 👍🏼 -- if that does work, I think we can move forward with this issue. |
I tested this by myself using the documentation of the theme and I was able to reproduce the issue mentioned by the user: search doesn't work when removing the theme from So, adding the theme in BTW, the message about localization can be removed. I followed the same tests than for jQuery and in both cases (added/removed from I think, for now, we should update that note to mention it's required to add as an extension because of jQuery. |
As @evildmp noted, the installation docs say:
sphinx_rtd_theme/docs/installing.rst
Lines 11 to 22 in b07560b
However, just doing
html_theme = 'sphinx_rtd_theme'
works for most cases. There's a note below:sphinx_rtd_theme/docs/installing.rst
Lines 25 to 29 in b07560b
but I don't understand what it means. Perhaps projects that want to opt-out from localization can use the simplified procedure? What am I missing here?
The text was updated successfully, but these errors were encountered: