I hope I find a solution here for this quite intricate problem.
I use sphinx and intersphinx to document my project.
I have a class that inherits from mongoengine.Document.
When I build sphinx docs using sphinx-apidoc and the sphinx-build (via the autogenerated Makefile by sphinx-quickstart), references to mongoengine.Document classes are shown as mongoengine.document.Document, which is actually the correct fully qualified name but this is a problem, because on mongoengine project that class is labelled as mongoengine.Document so intersphinx doesn't link at all.
Is there a way to tell to sphinx to produce information on base classes as they are imported (in my code i have from mongoengine import Document) instead of its full module path?
The following code:
from mongoengine import Document, EmbeddedDocumentListField
class MyDocument(Document):
""" my docstring """
it produces some html like:
class myproj.models.MyDocument(*args, **values) Bases:
mongoengine.document.Document <-- intersphinx does not find the link to external doc!
instead of
class myproj.models.MyDocument(*args, **values)
Bases: mongoengine.Document <-- here intersphinx will properly link
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…