From c11d192e65c68b862578eecc917d6861460b4dc7 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler <4189642+patkan@users.noreply.github.com> Date: Thu, 24 Aug 2023 23:02:33 +0200 Subject: [PATCH] Fix import issues with qrcode in sphinx 7.2 (#552) * 7.2 introduces the issue * mock module qrcode for documentation build This prevents issues with sphinx 7.2 --- doc/conf.py | 4 ++++ doc/requirements.txt | 1 + tox.ini | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index 0c07a38..f7dc802 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -34,6 +34,7 @@ root = os.path.relpath(os.path.join(os.path.dirname(__file__), "..")) # ones. extensions = [ "sphinx.ext.autodoc", + "sphinx_autodoc_typehints", "sphinx.ext.doctest", "sphinx.ext.todo", "sphinx.ext.coverage", @@ -46,6 +47,9 @@ extensions = [ "sphinxcontrib.spelling", ] +# mock the following modules for autodoc +autodoc_mock_imports = ["qrcode"] + # supress warnings for external images suppress_warnings = [ "image.nonlocal_uri", diff --git a/doc/requirements.txt b/doc/requirements.txt index 25808d4..694ba21 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -11,4 +11,5 @@ python-barcode>=0.11.0,<1 importlib-metadata importlib_resources sphinxcontrib.datatemplates +sphinx-autodoc-typehints pycups diff --git a/tox.ini b/tox.ini index c990d90..ad1b518 100644 --- a/tox.ini +++ b/tox.ini @@ -30,11 +30,12 @@ setenv = PY_IGNORE_IMPORTMISMATCH=1 [testenv:docs] basepython = python changedir = doc -deps = sphinx>=3.0.0 +deps = sphinx>=7.2.3 setuptools_scm python-barcode sphinxcontrib-spelling>=7.2.0 sphinxcontrib.datatemplates + sphinx-autodoc-typehints sphinx_rtd_theme pycups commands = sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html