Get dosctring without import

Ben Finney ben+python at
Fri Feb 26 13:35:30 CET 2010

Joan Miller <peloko45 at> writes:

> I use a function in '' to get automatically the description
> from the package's docstring, but there is a problem when you import a
> module that has to be built by cython (because it tries load a module
> that doesn't exists).

A simple approach (at least, simpler than crawling a parse tree) might
be to store the package description in a separate non-executable file.

A common convention is to have a ‘README’ text file, written in
reStructuredText for rendering to various output formats as part of the
documentation. You could then have the ‘’ program read the
contents of that file and use it (or a slice of it) for the package

 \                         “Sometimes I — no, I don't.” —Steven Wright |
  `\                                                                   |
_o__)                                                                  |
Ben Finney

More information about the Python-list mailing list