@@ -37,7 +37,7 @@ def add_line(self, line: str, source: str, *lineno: int) -> None:
3737# Mock imports for Sphinx documentation generation
3838autodoc_mock_imports = [
3939 # Heavy / optional scientific stack
40- 'numpy' , 'pandas' , 'scipy' , 'torch' , 'transformers' , 'sklearn' , 'matplotlib' , ' networkx' ,
40+ 'numpy' , 'pandas' , 'scipy' , 'torch' , 'transformers' , 'sklearn' , 'networkx' ,
4141 # Embedding / NLP helper libs
4242 'sentence_transformers' , 'simpleneighbors' , 'syllables' ,
4343 # LangChain ecosystem
@@ -51,6 +51,21 @@ def add_line(self, line: str, source: str, *lineno: int) -> None:
5151 'tqdm' , 'print_color' , 'jinja2' , 'graphviz' , 'PIL' , 'tenacity' , 'joblib'
5252]
5353
54+ # Custom mock for matplotlib to handle rcParams assignment
55+ from unittest .mock import MagicMock
56+
57+ class MockRcParams (dict ):
58+ """Mock rcParams that behaves like a dict and supports item assignment."""
59+ def __setitem__ (self , key , value ):
60+ super ().__setitem__ (key , value )
61+
62+ class MockMatplotlib (MagicMock ):
63+ """Mock matplotlib with properly configured rcParams."""
64+ rcParams = MockRcParams ()
65+
66+ sys .modules ['matplotlib' ] = MockMatplotlib ()
67+ sys .modules ['matplotlib.pyplot' ] = MagicMock ()
68+
5469# -- Project version ---------------------------------------------------------
5570
5671_version_re__ = r"__version__\s*=\s*['\"]([^'\"]+)['\"]"
0 commit comments