Skip to content
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

sphinx-themes breaks with Flamingo 1.7.1 and Python 3.10 #28

Closed
SmithChart opened this issue Apr 7, 2022 · 6 comments
Closed

sphinx-themes breaks with Flamingo 1.7.1 and Python 3.10 #28

SmithChart opened this issue Apr 7, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@SmithChart
Copy link
Member

With Python 3.10 the sphinx-themes feature breaks:

make html
. env/bin/activate && \
flamingo build -s settings.py menu.py 
ERROR:flamingo.core.PluginManager:setup of 'flamingo.plugins.SphinxThemes' failed
Traceback (most recent call last):
  File "/home/bbu/scm/ptx/ptx-admin-workplace-mr/ptx-infrastructure-manual/env/lib/python3.10/site-packages/flamingo/core/utils/imports.py", line 19, in acquire
    item = importlib.import_module(item)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'flamingo.plugins.SphinxThemes'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bbu/scm/ptx/ptx-admin-workplace-mr/ptx-infrastructure-manual/env/lib/python3.10/site-packages/flamingo/core/plugins/plugin_manager.py", line 91, in __init__
    plugin_class, plugin_path = acquire(plugin)
  File "/home/bbu/scm/ptx/ptx-admin-workplace-mr/ptx-infrastructure-manual/env/lib/python3.10/site-packages/flamingo/core/utils/imports.py", line 34, in acquire
    item = getattr(module, attr_name)
AttributeError: module 'flamingo.plugins' has no attribute 'SphinxThemes'

Removing the catchall in https://github.com/pengutronix/flamingo/blob/master/flamingo/plugins/__init__.py#L50 yields the actual problem:

$make html
. env/bin/activate && \
flamingo build -s settings.py menu.py 
ERROR:flamingo.core.PluginManager:setup of 'flamingo.plugins.HTML' failed
Traceback (most recent call last):
  File "/home/chris/work/Projects/github/flamingo/flamingo/core/utils/imports.py", line 19, in acquire
    item = importlib.import_module(item)
  File "/home/chris/.pyenv/versions/3.10.2/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/chris/work/Projects/github/flamingo/flamingo/plugins/__init__.py", line 49, in <module>
    from .sphinx_themes.plugin import SphinxThemes  # NOQA
  File "/home/chris/work/Projects/github/flamingo/flamingo/plugins/sphinx_themes/plugin.py", line 10, in <module>
    from sphinx.jinja2glue import _tobool, _todim, _toint, accesskey
  File "/home/chris/work/Projects/ptxadmin/ptx-infrastructure-manual/env/lib/python3.10/site-packages/sphinx/jinja2glue.py", line 20, in <module>
    from sphinx.application import TemplateBridge
  File "/home/chris/work/Projects/ptxadmin/ptx-infrastructure-manual/env/lib/python3.10/site-packages/sphinx/application.py", line 32, in <module>
    from sphinx.config import Config
  File "/home/chris/work/Projects/ptxadmin/ptx-infrastructure-manual/env/lib/python3.10/site-packages/sphinx/config.py", line 21, in <module>
    from sphinx.util import logging
  File "/home/chris/work/Projects/ptxadmin/ptx-infrastructure-manual/env/lib/python3.10/site-packages/sphinx/util/__init__.py", line 41, in <module>
    from sphinx.util.typing import PathMatcher
  File "/home/chris/work/Projects/ptxadmin/ptx-infrastructure-manual/env/lib/python3.10/site-packages/sphinx/util/typing.py", line 37, in <module>
    from types import Union as types_Union
ImportError: cannot import name 'Union' from 'types' (/home/chris/.pyenv/versions/3.10.2/lib/python3.10/types.py)

This was fixed with Sphinx 4.2.0 (https://www.sphinx-doc.org/en/master/changes.html#release-4-2-0-released-sep-12-2021 ) (and PR sphinx-doc/sphinx#9512 ).
But this release (and newer) in incompatible with the flamingo-integration.

@SmithChart SmithChart added the bug Something isn't working label Apr 7, 2022
@rschwebel
Copy link
Contributor

These are indeed 2 problems: the sphinx update and flamingo failing with python 3.10. Let's focus on the first one in this issue, I'll open another issue afterwards.

@rschwebel
Copy link
Contributor

The Sphinx- and sphinx_rtd_theme update is now in #29.

@rschwebel
Copy link
Contributor

Turns out that problem no 2 above was some left over debug code in a local python 3.10 installation. The testsuite works fine with python 3.10 with #29.

@rschwebel
Copy link
Contributor

@SmithChart Now as #29 has been merged, could you test if this solves this issue?

@SmithChart
Copy link
Member Author

Didn't try this for some time. As of now with Python 3.10.4 and #36 I can build the flamingo documentation as expected.
I am currently testing with:

Sphinx==5.3.0
sphinx-rtd-theme==1.1.1
Pygments==2.13.0

I suggest to close this issue once #36 is merged.

@SmithChart
Copy link
Member Author

#36 is merged -> closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants