how to recursively autodoc a whole project?

3,953 views
Skip to first unread message

Evgeny

unread,
Jun 25, 2010, 5:28:51 PM6/25/10
to sphinx-dev
Hi folks,

is it possible to insert complete autodoc from all contents
(subpackages and all) of a package.

For example I have a project that has an empty file __init__.py, a
bunch of other .py files and directories that contain other
__init__.py and so on.

Is there a way to extract all docstrings at once from entire project
by giving only a name of the main module?

I've tried creating a file called modules.rst with

.. automodule::
:members:

But this only takes out a docstring from the toplevel __init__.py and
that's it.

Thanks!.

Evgeny.

DasIch

unread,
Jun 25, 2010, 7:09:21 PM6/25/10
to sphin...@googlegroups.com
Sphinx is intended to be used as a tool for handwritten documentation so
you probably won't find a satisfying solution for this unless you switch
to something like pydoc.

Nevertheless there is the autosummary
<http://sphinx.pocoo.org/ext/autosummary.html> extension which is
supposed to more or less solve this problem.

etienned

unread,
Jun 26, 2010, 9:53:53 AM6/26/10
to sphinx-dev
A solution is to use this script <http://bitbucket.org/etienned/sphinx-
autopackage-script> that autogenerate all the necessary .rst files
from your project. It should do what you want.

Kevin Mills

unread,
Jun 26, 2010, 12:48:33 PM6/26/10
to sphinx-dev
I tried your script and it saved lots of time, but is there anything out there that will pull in the docstrings that I might have throught out the modules?

Thanks,

Kevin

43rd Law of Computing:
Anything that can go wr
fortune: Segmentation violation -- Core dumped


--
You received this message because you are subscribed to the Google Groups "sphinx-dev" group.
To post to this group, send email to sphin...@googlegroups.com.
To unsubscribe from this group, send email to sphinx-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en.


Evgeny

unread,
Jun 27, 2010, 3:53:39 PM6/27/10
to sphinx-dev
Hi Etienne,

I've tried the script too - would you make the license on your script
compatible with sphinx?

Thanks!

Evgeny.

Evgeny

unread,
Jun 27, 2010, 7:52:27 PM6/27/10
to sphinx-dev
maybe you don't have autodoc extension enabled?
it will extract those strings on the second pass - when you run `make
html`

I have in my conf.py:

extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo',
'sphinx.ext.coverage',]# 'sphinx.ext.viewcode']

unfortunately I had to comment out viewcode due to some bug.

Cheers.

Evgeny.


On Jun 26, 9:48 am, Kevin Mills <mill...@gmail.com> wrote:
> I tried your script and it saved lots of time, but is there anything out
> there that will pull in the docstrings that I might have throught out the
> modules?
>
> Thanks,
>
> Kevin
>
> 43rd Law of Computing:
> Anything that can go wr
> fortune: Segmentation violation -- Core dumped
>
> On Sat, Jun 26, 2010 at 8:53 AM, etienned <etienne.desaut...@gmail.com>wrote:
>
>
>
> > A solution is to use this script <http://bitbucket.org/etienned/sphinx-
> > autopackage-script<http://bitbucket.org/etienned/sphinx-%0Aautopackage-script>>
> > that autogenerate all the necessary .rst files
> > from your project. It should do what you want.
>
> > On Jun 25, 7:09 pm, DasIch <dasdas...@googlemail.com> wrote:
> > > Sphinx is intended to be used as a tool for handwritten documentation so
> > > you probably won't find a satisfying solution for this unless you switch
> > > to something like pydoc.
>
> > > Nevertheless there is the autosummary
> > > <http://sphinx.pocoo.org/ext/autosummary.html> extension which is
> > > supposed to more or less solve this problem.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "sphinx-dev" group.
> > To post to this group, send email to sphin...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > sphinx-dev+...@googlegroups.com<sphinx-dev%2Bunsubscribe@googlegrou ps.com>
> > .

Kevin Mills

unread,
Jun 27, 2010, 8:33:41 PM6/27/10
to sphinx-dev
Thanks, yeah i forgot about autodoc.  Its been a long weekend haha.

Thanks again,


Kevin

43rd Law of Computing:
Anything that can go wr
fortune: Segmentation violation -- Core dumped


To unsubscribe from this group, send email to sphinx-dev+...@googlegroups.com.

etienned

unread,
Jun 29, 2010, 11:37:55 AM6/29/10
to sphinx-dev


On Jun 27, 3:53 pm, Evgeny <evgeny.fad...@gmail.com> wrote:
> I've tried the script too - would you make the license on your script
> compatible with sphinx?

I'm the author of this script but I'm not the rights owner. So I
cannot change the license. You can ask the rights owner, Société des
arts technologiques, directly. The guy responsible of this is Simon
Piette. You can find is email in this page: http://sat.qc.ca/page.php?lang=en&id=11
Reply all
Reply to author
Forward
0 new messages