Open themightyoarfish opened 6 years ago
See the proposed fix that I wrote over at #5518, I believe it would work.
I applied your proposed fix, but it doesn't do anything in this case.
I mean the modified try_import
definitely retrieves the class correctly (I don't know if that was the case before, but since my error is a reference one and not an import one I think yes), but the error stays the same, seems to come from a different part of the library.
Also, if I use .. automodule:: package.subpackage.module
instead, the build also runs. I don't understand what the logic is here.
Problem
The inability of Sphinx to work with (sub)packages comes up occasionally (see e.g. https://stackoverflow.com/questions/51881692/how-can-i-use-sphinx-with-subpackages-without-duplicating-everything), but I have met this issue again when using the
inheritance-diagrams
extension.I have this package structure
The files are given here:
package/init.py
package.subpackage/init.py
package.subpackage/module.py
So in summary, I'm using subpackages so I can write
package.subpackage.Class
instead ofpackage.subpackage.module.Class
.My sphinx configuration looks like this: Makefile
conf.py
index.rst
package.subpackage.rst
Error logs / results
Expected results
Sphinx can either resolve a reference such as
package.subpackage.module.Class
or ideallypackage.subpackage.Class
. Neither works.Reproducible project / your project
All files are attached: Archive.zip
Environment info