I have the following simple code structure:
code/
foo/
__init__.py
from bar import baz
from bar.baz import Baz
bar/
__init__.py
baz.py
class Baz(object):
"This is the Baz class".
pass
The "code" directory is added to sys.path in conf.py. In my index.rst
I have:
.. autoclass:: bar.baz.Baz
.. autoclass:: foo.Baz
.. autoclass:: foo.baz.Baz
Now the first two of these work as expected, but the last one fails
with a "no module named baz"
error, even though foo.baz is the Python module bar.baz because of the
statement in foo/__init__.py which says "from bar import baz".
If in conf.py I put the lines
import foo
print bar.baz.Baz
print foo.Baz
print foo.baz.Baz
then I get <class 'bar.baz.Baz'> printed thrice, as expected.
The reason I want to do this is, that foo's use of bar is effectively
an implementation detail. I want to represent bar.baz as foo.baz,
which I can't, though I can represent bar.baz.Baz as foo.Baz!
Obviously there are workarounds, but why should they be needed?
Regards,
Vinay
--
You received this message because you are subscribed to the Google Groups
"sphinx-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sphinx-dev?hl=en.