fixeria has uploaded this change for review.
docs/conf.py: add autodoc_mock_imports for klein and twisted
The eSIM SM-DP+ server modules (`pySim.esim.es2p`, `pySim.esim.es9p`,
`pySim.esim.http_json_api`) unconditionally import optional server-side
dependencies at module level:
pySim.esim.es2p -- from klein import Klein
pySim.esim.http_json_api -- from twisted.web.server import Request
Both imports fail during a docs build if the packages are absent or
broken, causing three "autodoc: failed to import" warnings and three
missing chapters in the generated manual.
Even when klein and twisted are installed, twisted 23.10.0 (the
version pulled in transitively by smpp.twisted3's `Twisted~=23.10.0`
constraint) is incompatible with Python 3.13+ because twisted.web.http
unconditionally executes `import cgi`, a module that was removed from
the standard library in Python 3.13.
Fix: add `autodoc_mock_imports = ['klein', 'twisted']` to conf.py.
Sphinx inserts mock entries into sys.modules before each autodoc import
attempt, so the modules can be imported and documented without requiring
the real packages to be importable at build time.
Change-Id: I71650466f02a6a6d150650deed167c05d2cb6e64
---
M docs/conf.py
1 file changed, 6 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/46/42546/1
diff --git a/docs/conf.py b/docs/conf.py
index 99107e2..165d235 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -65,6 +65,12 @@
autoclass_content = 'both'
+# es2p and http_json_api/es9p use optional server-side deps (klein, twisted.web)
+# that may be absent or Python-version-incompatible (twisted 23.x uses the
+# `cgi` stdlib module removed in Python 3.13). Mock them so autodoc can still
+# import and document those modules.
+autodoc_mock_imports = ['klein', 'twisted']
+
# sphinxarg.ext generates generic sub-headings ("Named arguments",
# "Positional arguments", "Sub-commands", "General options", ...) for every
# argparse command/tool. These repeat across many files and trigger tons
To view, visit change 42546. To unsubscribe, or for help writing mail filters, visit settings.