python - 使用 SPHINX、FURO、AUTODOC 构建 html 文档。错误样式表

标签 python python-sphinx autodoc

我尝试在我的 python 项目中将 SPHINX 与 FURO html 主题一起使用。当我尝试构建 html 时,构建失败。

我使用以下conf.py:

# Configuration file for the Sphinx documentation builder.


import os
import sys

sys.path.insert(0, os.path.abspath('../'))


project = 'MyPorject+'
copyright = '2022, XXXXX' 
author = 'XXXX'
release = '0.3.0'


extensions = ['sphinx.ext.autodoc',
              'sphinx.ext.napoleon',
              'sphinx.ext.duration']


autodoc_default_options = {'members': True,
                           'undoc-members': True,
                           'show-inheritance': True,
                           'recursive': True, }


templates_path = ['_templates']


exclude_patterns = []


html_theme = 'furo'


html_theme_options = {"light_css_variables": {"color-brand-primary": "#9e007e",
                                              "color-brand-content": "#00a9e0",
                                              },
                      "dark_css_variables": {"color-brand-primary": "#5c2483",
                                             "color-brand-content": "#2268b1",
                                             },
                      "light_logo": "logo-light-mode.png",
                      "dark_logo": "logo-dark-mode.png",
                      "announcement": "<em>Important</em> Doku befindet sich im Aufbau!",
                      }

html_static_path = ['_static']


pygments_style = "sphinx"
pygments_dark_style = "monokai"


napoleon_google_docstring = True
napoleon_numpy_docstring = True
napoleon_include_init_with_doc = True
napoleon_include_private_with_doc = True
napoleon_include_special_with_doc = True`

当我尝试使用此 conf.py 构建时,已打印此错误:

Configuration error:
This documentation is not using `furo.css` as the stylesheet. If you have set `html_style` in your conf.py file, remove it.

但是正如您所看到的,我的 conf.py 中没有设置 html_style。我使用 Poetry 安装到我的 .venv 中。我在项目的其他地方找不到 html_style 的任何其他用途。我可以在 conf.py 中设置样式表吗? 您是否对我的错误有任何提示...我想这是非常明显的事情...

非常感谢!

最佳答案

我能够使用 Sphinx 7.0.2 和 Furo 2023.8.19 重现此错误。我按照此 GitHub Issue 将 sphinx 更新到最新版本(7.2.5)这为我解决了这个问题。

看起来您需要运行 poetry update对于狮身人面像和福罗。

关于python - 使用 SPHINX、FURO、AUTODOC 构建 html 文档。错误样式表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/77022730/

相关文章:

python - Sphinx 找不到我的 python 文件。说 'no module named ...'

python-sphinx - 狮身人面像 : how to exclude imports in automodule?

python - Sphinx autodoc 没有导入任何东西?

python - 在递归中使用 scrapy 回调时 xlsxwriter 无法创建文件

python - 使用 nosql 排名在 SQLalchemy 中排序和分页

python - Python 中的每类 @property 装饰器

emacs - 将模式从正则表达式设置为正则表达式?

html - 我可以在 GitLab 上渲染 HTML 吗?

python - 如何在长函数签名中换行并在 Sphinx autodoc 中对其进行漂亮的格式化

python - 使用过滤器发出 GET 请求