sphinx-argparse
sphinx-argparse copied to clipboard
Add support for autodoc_mock_imports or similar mechanism
Importing 3rd party libraries/modules, requires those be mocked to avoid raising ModuleNotFoundError
when using sphinx.
One possibility is to use mock.Mock() as suggested in https://github.com/alex-rudakov/sphinx-argparse/issues/87 or https://github.com/readthedocs/readthedocs.org/issues/4855. One caveat is that is that sub-modules need to be mocked as well.
Our project is making use of the autodoc extension and all of our 3rd party imports were already mocked using autodoc_mock_imports
. Upon enabling sphinx-argparse, the error reappeared which was confusing.
Would it be possible that sphinx-argparse makes use of this value if it is already present one way or another ? An additional advantage is that, autodoc_mock_imports
requires only that top-level be declared since sphinx 1.6.
Alternatively or in the meantime, it would be good to remind users in the documentation that modules have to be "mocked" and that autodoc_mock_imports
is not used.