astropy / astropy/sphinx-automodapi

sphinx_automodapi.automodsumm doesn't resolve autodoc_mock_imports

Open
#148 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
67
Forks
48
Avg merge
11h 52m
Merged PRs (30d)
1

Description

I have a python package module that imports 3rd party modules which aren't included in the sphinx documentation. So I added these modules to mock imports in the ``conf.py``

```python
autodoc_mock_imports = ["abaqus", "abaqusConstants","material","section","part","assembly", "step", "interaction","mesh","load","job","optimization","sketch", "odbAccess", "connectorBehavior","pandas","numpy","matplotlib","scipy"]
```

While using the mock imports works with the sphinx ``automodule`` directive without throwing an error.
```rst
.. automodule:: mymodule
```

I get the an error when using the module with ``automodapi`` directive.
```rst
.. automodapi:: mymodule
```
Error:
```
Extension error (sphinx_automodapi.automodsumm):
Handler for event 'builder-inited' threw an exception (exception: No module named 'abaqus')
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with conf.py and compare how Sphinx's automodule handles autodoc_mock_imports with the automodapi directive. Trace sphinx_automodapi.automodsumm.process_automodsumm_generation; done means automodapi can document mymodule without raising No module named 'abaqus'.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.