From b8c7eec940cba0cd8c64c1c835ac050ec0799830 Mon Sep 17 00:00:00 2001 From: Tom Pollard Date: Sat, 31 Oct 2026 15:38:40 -0400 Subject: [PATCH] Use Sphinx's mocking for dependencies in the docs build. The hand-written MagicMock modules made type annotations render as their repr, so Record.to_dataframe() was shown as returning . autodoc_mock_imports shows the mocked name (pandas.DataFrame) instead. The rest of the generated HTML is unchanged. --- docs/conf.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 06cd929b..779af430 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -22,18 +22,9 @@ sys.path.insert(0, os.path.abspath("../src")) -# For dependencies -from unittest.mock import MagicMock - - -class Mock(MagicMock): - @classmethod - def __getattr__(cls, name): - return MagicMock() - - -MOCK_MODULES = ["numpy", "matplotlib", "matplotlib.pyplot", "pandas", "scipy"] -sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES) +# Heavy dependencies aren't installed for the docs build. Sphinx mocks them, and +# shows mocked names in signatures (e.g. `pandas.DataFrame`). +autodoc_mock_imports = ["numpy", "matplotlib", "pandas", "scipy"] # -- General configuration ------------------------------------------------