Get dosctring without import

Ben Finney ben+python at benfinney.id.au
Fri Feb 26 07:35:30 EST 2010


Joan Miller <peloko45 at gmail.com> writes:

> I use a function in 'setupy.py' 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 ‘setup.py’ program read the
contents of that file and use it (or a slice of it) for the package
description.

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



More information about the Python-list mailing list