0

I have a project with the following directory structure:

project
    datasets
        __init__.py
        foo.py
        bar.py

bar.py defines a class Bar which inherits from the Foo class defined in foo.py. In __init__.py, I have the following import alias:

from .foo import Foo
from .bar import Bar

__all__ = ("Foo", "Bar")

This allows users to easily say from project.datasets import Bar without worrying about what file Bar is defined in.

My problem is that when I go to use Sphinx autodoc, nitpick gives me the following warnings:

project.datasets.bar.py:docstring of project.datasets.Bar:1: WARNING: py:class reference target not found: project.datasets.foo.Foo

Is there some way to tell Sphinx autodoc that project.datasets.foo.Foo is project.datasets.Foo? Or some other way to point project.datasets.foo.Foo to the documentation for project.datasets.Foo? autodoc-process-bases looks like a promising hack, but hasn't been released yet.

mzjn
  • 48,958
  • 13
  • 128
  • 248
Adam Stewart
  • 2,001
  • 1
  • 16
  • 16

0 Answers0