Thoughts on audodoc source code after writing the tutorial.

17 views
Skip to first unread message

igo...@gmail.com

unread,
Mar 10, 2021, 10:28:20 AM3/10/21
to sphinx-dev
Hello,

Since my last post I managed to write the tutorial on autodoc
extensions. (and it got merged, thank you for feedback)

However, after going over autodoc source code during writing the
turorial I got the feeling
that it can be significantly improved to make much easier to extend and
maintain.

For example, add_directive_header method.

Right now if you want to add new option you have to manually indent it:

self.add_line(' :property:', sourcename)

What I would do is to add a new method iter_directive_options which
would iterate over the options.
The add_directive_header of the Documenter super class would call this
method and
indent and append all iterated options. This way when you extend the
directive header you won't need to bother
with manual indentation.

PS. Is there going to be a minimum version bump in 4.0.0 ? Autodoc
module has a bunch of very old comment based
type hints. I would recommend bumping to at least Python 3.7 as this
will make __future__ annotations available.
Without that future old "quoted" type hints will error on Python 3.10


Reply all
Reply to author
Forward
0 new messages