ionelmc / cookiecutter-pylibrary

Enhanced cookiecutter template for Python libraries.
BSD 2-Clause "Simplified" License
1.25k stars 207 forks source link

Bad configuration when sphnix_theme is set to furo #241

Open manuuurino opened 1 year ago

manuuurino commented 1 year ago

Template sphnix configuration wont work with furo.

To repuduce, i have used this configuration

default_context:
    allow_tests_inside_package: "no"
    c_extension_function: "longest"
    c_extension_module: "_nameless"
    c_extension_optional: "no"
    c_extension_support: "no"
    codacy: "no"
    codacy_projectid: "[Get ID from https://app.codacy.com/gh/ionelmc/python-nameless/settings]"
    codeclimate: "no"
    codecov: "yes"
    command_line_interface: "plain"
    command_line_interface_bin_name: "nameless"
    coveralls: "no"
    distribution_name: "nameless"
    email: "contact@ionelmc.ro"
    formatter_quote_style: "double"
    full_name: "Ionel Cristian Maries"
    github_actions: "yes"
    github_actions_osx: "yes"
    github_actions_windows: "yes"
    license: "BSD 2-Clause License"
    package_name: "nameless"
    pre_commit: "yes"
    project_name: "Nameless"
    project_short_description: "An example package. Generated with cookiecutter-pylibrary."
    pypi_badge: "yes"
    pypi_disable_upload: "no"
    release_date: "today"
    repo_hosting: "github.com"
    repo_hosting_domain: "github.com"
    repo_main_branch: "main"
    repo_name: "python-nameless"
    repo_username: "ionelmc"
    scrutinizer: "no"
    setup_py_uses_setuptools_scm: "no"
    sphinx_docs: "yes"
    sphinx_docs_hosting: "https://python-nameless.readthedocs.io/"
    sphinx_doctest: "no"
    sphinx_theme: "furo"
    test_matrix_separate_coverage: "no"
    version: "0.0.0"
    version_manager: "bump2version"
    website: "https://blog.ionelmc.ro"
    year_from: "2023"
    year_to: "2023"

Trying to build the docs

~/Dev/python-nameless main +37 !1 ❯ tox -e docs                                                                                                        system
docs: install_deps> python -I -m pip install -r /media/ext-nvme/Dev/python-nameless/docs/requirements.txt
.pkg: install_requires> python -I -m pip install 'setuptools>=30.3.0'
.pkg: _optional_hooks> python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: get_requires_for_build_editable> python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: install_requires_for_build_editable> python -I -m pip install wheel
.pkg: get_requires_for_build_sdist> python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: build_editable> python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
docs: install_package> python -I -m pip install --force-reinstall --no-deps /media/ext-nvme/Dev/python-nameless/.tox/.tmp/package/1/nameless-0.0.0-0.editable-py3-none-any.whl
docs: commands[0]> sphinx-build -E -b html docs dist/docs
Running Sphinx v7.0.1

Configuration error:
There is a programmable error in your configuration file:

Traceback (most recent call last):
  File "/media/ext-nvme/Dev/python-nameless/.tox/docs/lib/python3.11/site-packages/sphinx/config.py", line 354, in eval_config_file
    exec(code, namespace)  # NoQA: S102
    ^^^^^^^^^^^^^^^^^^^^^
  File "/media/ext-nvme/Dev/python-nameless/docs/conf.py", line 29, in <module>
    html_theme_path = [furo.get_html_theme_path()]
                       ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'furo' has no attribute 'get_html_theme_path'

docs: exit 2 (0.16 seconds) /media/ext-nvme/Dev/python-nameless> sphinx-build -E -b html docs dist/docs pid=377174
.pkg: _exit> python /usr/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
  docs: FAIL code 2 (8.38=setup[8.22]+cmd[0.16] seconds)
  evaluation failed :( (8.48 seconds)

I havent investigated it further, but commenting these lines, building works.

diff --git a/docs/conf.py b/docs/conf.py
index 3de091a..5414cc8 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -26,17 +26,17 @@ extlinks = {
     "pr": ("https://github.com/ionelmc/python-nameless/pull/%s", "PR #"),
 }
 html_theme = "furo"
-html_theme_path = [furo.get_html_theme_path()]
+# html_theme_path = [furo.get_html_theme_path()]
 html_theme_options = {
-    "githuburl": "https://github.com/ionelmc/python-nameless/",
+    # "githuburl": "https://github.com/ionelmc/python-nameless/",
 }

 html_use_smartypants = True
 html_last_updated_fmt = "%b %d, %Y"
 html_split_index = False
-html_sidebars = {
-    "**": ["searchbox.html", "globaltoc.html", "sourcelink.html"],
-}
+# html_sidebars = {
+#     "**": ["searchbox.html", "globaltoc.html", "sourcelink.html"],
+# }
 html_short_title = f"{project}-{version}"

 napoleon_use_ivar = True