Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autodoc tries to import classes as modules #98

Closed
amueller opened this issue Jun 18, 2017 · 1 comment
Closed

autodoc tries to import classes as modules #98

amueller opened this issue Jun 18, 2017 · 1 comment

Comments

@amueller
Copy link
Contributor

From sphinx-doc/sphinx#3768 as I suspect it might be a numpydoc issue after all.

After updating sphinx and numpydoc, I get

WARNING: /home/andy/checkout/scikit-learn/doc/modules/generated/sklearn.preprocessing.RobustScaler.rst:92: (WARNING/2) autodoc: failed to import method 'RobustScaler.__init__' from module 'sklearn.preprocessing.data.RobustScaler'; the following exception was raised:
Traceback (most recent call last):
  File "/home/andy/anaconda3/lib/python3.5/site-packages/sphinx/ext/autodoc.py", line 658, in import_object
    __import__(self.modname)
ImportError: No module named 'sklearn.preprocessing.data.RobustScaler'; 'sklearn.preprocessing.data' is not a package

for every class in the package.

It looks like the modname is wrong as it is the class and not the module. I'm not sure what should be imported at this point, though. The class? Importing a method doesn't seem to make a lot of sense...

Repo to reproduce:
https:/amueller/sphinx-debug

WARNING: /home/andy/checkout/sphinx-debug/doc/modules/generated/blablub.BaseEstimator.rst:28: (WARNING/2) autodoc: failed to import method 'BaseEstimator.__init__' from module 'blablub.BaseEstimator'; the following exception was raised:
Traceback (most recent call last):
  File "/home/andy/checkout/sphinx/sphinx/ext/autodoc.py", line 657, in import_object
    __import__(self.modname)
@amueller
Copy link
Contributor Author

Fixed in master, possibly via #93, thanks @jschueller for the pointer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant