-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Note: This post has been massively edited because it was originally based on a misunderstanding on my part. I hope it makes more sense now. Unfortunately I can't seem to edit the title.
Consider a project structured like this:
package/
__init__.py
module.py
__init__.py contains:
from .module import Class
module.py contains:
class Class:
pass
The docs generated by autodoc look like this:
package package
Submodules
package.module moduleclass package.module.Class
Bases: object
Module contents
This is very different from what the user is supposed to see. A user would import Class with from package import Class, not with from package.module import Class. The user doesn't need to know in which file Class was defined. From the user's perspective, Class is located in package, and module doesn't even exist. The docs would be a lot more helpful if they looked like this:
package module
Module contents
class Class
The relevant changes I made are the following:
Classis listed directly inpackagerather than inpackage.modulemoduleisn't listed as a submodule, because it doesn't contain anything relevant
This accurately displays package's public interface; there is no useless non-information in this documentation. If autodoc could produce output like this, it would be a massive improvement.