I'm trying to use Sphinx to autodoc my code (psiexperiment). Some third-party libraries are not available on Linux (e.g., tdt) so I can't have them installed when generating the documentation via readthedocs. I tried mocking them (e.g., autodoc_mock_imports = ['tdt']); however, I get the following error:
WARNING: autodoc: failed to import module 'tdt' from module 'psi.controller.engines'; the following exception was raised:
<snip>
File "/home/bburan/Documents/OHSU/LBHB/psiexperiment/psi/controller/engines/tdt/__init__.py", line 134, in <module>
class TDTEngine(Engine):
File "/home/bburan/Documents/OHSU/LBHB/psiexperiment/psi/controller/engines/tdt/__init__.py", line 161, in TDTEngine
_project = Typed(DSPProject)
File "/home/bburan/bin/miniconda3/envs/ohsu-psi/lib/python3.9/site-packages/atom/typed.py", line 55, in __init__
self.set_validate_mode(Validate.Typed, kind)
TypeError: Expected object of type `type`. Got object of type `DSPProject` instead.
Here, DSPProject is imported from the tdt module. I understand the nature of the error itself (i.e., something about autodoc_mock_imports is generating a mock class that is not a type but rather a class instance (presumably of a mock class).
Is there any simple way to better generate the mockup for the DSPProject class without resorting to tricks to detect whether sphinx is running and providing a specially-mocked DSPProject class?
Brad