mgeier / insipid-sphinx-theme

:yawning_face: An insipid theme for the Sphinx documentation generator.
https://insipid-sphinx-theme.readthedocs.io/
BSD 2-Clause "Simplified" License
39 stars 4 forks source link

theme not found (Sphinx 3.1.2, Python 3.8) #18

Closed shaloo closed 3 years ago

shaloo commented 4 years ago

Hi, what could be the issue here - i can use other themes that are deployed in my virtual environment but not insipid-sphinx-theme?

  1. Pip shows it as installed

$>pip3 list | grep insipid insipid-sphinx-theme 0.1.2

  1. Conf.py has html_theme = 'insipid' (Also tried with insipid_sphinx_theme)

Error:

make clean html Removing everything under 'build'... Running Sphinx v3.1.2 Initializing Spelling Checker making output directory... done

Theme error: no theme named 'insipid_sphinx_theme' found (missing theme.conf?) make: *** [html] Error 2

I seem to be missing something basic here. Tried to add html_theme_path in confirmation.py which actually points to the theme.conf

html_theme_path = ['/usr/local/lib/python3.8/site-packages/insipid_sphinx_theme/insipid']

yet no luck.

shaloo commented 4 years ago

Ah! Just saw your msg regarding https://insipid-sphinx-theme.readthedocs.io/en/latest/index.html

Will wait until you share updated release - the new color scheme is fine i like the blue highlight.

shaloo commented 4 years ago

Workaround: The following worked for me

Zipped the theme and stored it in doc/source/insipid folder Provided this path as html_theme_path in Configuration.py

You need to follow third party theme setup as listed here I guess so that sphinx can find it (outside RTD)

https://www.sphinx-doc.org/en/master/development/theming.html

and add this in setup.py (entry point is already setup I saw in your setup.py)

# 'your_package.py'
from os import path

def setup(app):
    app.add_html_theme('name_of_theme', path.abspath(path.dirname(__file__)))
mgeier commented 4 years ago

You don't need this work-around, just use html_theme = 'insipid'.

Regarding your error:

Theme error: no theme named 'insipid_sphinx_theme' found (missing theme.conf?)

Here you were using html_theme = 'insipid_sphinx_theme', which is not the name of the theme.

shaloo commented 4 years ago

You don't need this work-around, just use html_theme = 'insipid'.

Regarding your error:

Theme error: no theme named 'insipid_sphinx_theme' found (missing theme.conf?)

Here you were using html_theme = 'insipid_sphinx_theme', which is not the name of the theme.

Well I tried first with ‘insipid’ and got this error. Then I tried again with the longer name. Same error. But workaround did not cause this error.

mgeier commented 4 years ago

Well I tried first with ‘insipid’ and got this error.

Can you please provide the full error message in this case? And ideally also a reproducible minimal example?

You really shouldn't have to use the mentioned work-around.

shaloo commented 4 years ago

Thank you for the update. I tried the new version 0.2 it gives the same error if I only specify html_theme in Conference.py as 'insipid'. If I add html_theme_path to the actual path where it is installed, then it works! I will share a minimum working example shortly. Cant share my project data files.

mgeier commented 4 years ago

@shaloo Do you happen to have different Python versions or multiple virtual environments? If yes, you might have installed the insipid theme for one Python version but use a different one for running Sphinx?

If you use python3 -m pip instead of pip (or pip3) you can avoid most of those problems. To be sure, you can also try using python3 -m sphinx instead of using the Makefile (which makes it unclear which Python version is used). See point 5 in https://insipid-sphinx-theme.readthedocs.io/en/0.2.0/usage.html.

mgeier commented 3 years ago

@shaloo Any news?

shaloo commented 3 years ago

Hi, Hope you had a great start to 2021!

I tried the latest version, today, it looks fine. Did not have any python issue as before. But I am not able to see the LHS TOC when I click on the menu item on top LHS. It shows up as empty. Don't remember this issue in previous version.

mgeier commented 3 years ago

Thanks for the update @shaloo!

Can you please provide a minimal reproducible example for your issue?

Feel free to create a new issue with information on how to reproduce the problem.

shaloo commented 3 years ago

Hi, during the process of creating minimal reproducible example (MRE), i seem to have debugged the issue. Here is what is happening...

So the insipid theme is not tolerant, if a user wishes to overwrite the footer and does NOT use super() unlike default sphinx themes. Let me remove my work specific data in the files and share the code here - to be added...

shaloo commented 3 years ago
mre_nosidebar
shaloo commented 3 years ago

After adding super in layout.html (See compressed src files in MRE)

mre_sidebar
shaloo commented 3 years ago

insipid-theme-issue.zip

mgeier commented 3 years ago

Thanks for the update!

So the insipid theme is not tolerant, if a user wishes to overwrite the footer and does NOT use super() unlike default sphinx themes.

I must confess that I indeed abused the footer block to some degree. One of the reasons why the sidebar is in the footer block is because I want it down there if JavaScript is disabled by the visitor and the screen is narrow (e.g. on a smartphone). If you have suggestions for how to avoid this problem, please let me know!

However, since the footer block is more or less unusable for customizing the insipid theme, I have introduced an additional template named footer.html. This is mentioned at https://insipid-sphinx-theme.readthedocs.io/en/0.2.2/customization.html#custom-templates, the file is there: https://github.com/mgeier/insipid-sphinx-theme/blob/0.2.2/src/insipid_sphinx_theme/insipid/footer.html.

Can you achieve what you want by overriding the footer.html template?

Again, if you have ideas how to improve the situation, let me know!

mgeier commented 2 years ago

I must confess that I indeed abused the footer block to some degree.

I've removed the abuse of the footer block in #70, now the footer block in layout.html can be overwritten/customized as usual.

The separate footer.html template is still available and can be customized as before. In case of doubt, I recommend customizing footer.html.