I am trying to generate API documentation from comments (in numpydoc style) in my project and I am stuck at vague import errors from sphinx:
/home/carbolymer/workspace/si-app/doc/source/scripts.rst:10: WARNING: autodoc: failed to import module 'scripts.backtest'; the following exception was raised:
Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/sphinx/ext/autodoc.py", line 547, in import_object
__import__(self.modname)
File "/home/carbolymer/workspace/si-app/application/scripts/backtest.py", line 6, in <module>
from scipy import stats
File "/usr/lib/python3.5/site-packages/scipy/__init__.py", line 64, in <module>
from numpy import __version__ as __numpy_version__
ImportError: cannot import name '__version__'
/home/carbolymer/workspace/si-app/doc/source/scripts.rst:18: WARNING: autodoc: failed to import module 'scripts.importdb'; the following exception was raised:
Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/sphinx/ext/autodoc.py", line 547, in import_object
__import__(self.modname)
File "/home/carbolymer/workspace/si-app/application/scripts/importdb.py", line 5, in <module>
from si.storage.dataimport import DataImport, database_drivers, sources
File "/home/carbolymer/workspace/si-app/application/si/storage/dataimport.py", line 6, in <module>
from si.storage.datasource.file import Stooq as StooqFile
File "/home/carbolymer/workspace/si-app/application/si/storage/datasource/file.py", line 19, in <module>
from si.storage.datasource.util import correct_prices
File "/home/carbolymer/workspace/si-app/application/si/storage/datasource/util.py", line 4, in <module>
def correct_prices(dataframe, calendar=PolishCalendar()):
File "/usr/lib/python3.5/unittest/mock.py", line 917, in __call__
return _mock_self._mock_call(*args, **kwargs)
File "/usr/lib/python3.5/unittest/mock.py", line 976, in _mock_call
result = next(effect)
StopIteration
Full log:
I've tried mocking numpy.__version__
but it does not work. Also I have no clue what about the lines containing PolishCalendar()
- why sphinx is trying to mock this object?
Because of those import errors, these files are missing in the documentation. How can I fix this?
My build command:
make clean ; sphinx-apidoc -a -f -o ./source ../application ; make html
Versions:
$ sphinx-build --version
Sphinx (sphinx-build) 1.5.1
$ python --version
Python 3.5.2
source/conf.py: http://pastebin.com/VfsiX4uZ