[SciPy-dev] On scipy/numpy documentation, and executing code in docstrings

Fernando Perez fperez.net@gmail....
Wed Aug 5 17:38:05 CDT 2009


On Wed, Aug 5, 2009 at 1:49 PM, Emmanuelle
Gouillart<emmanuelle.gouillart@normalesup.org> wrote:
>> One thing that I'm not very happy with the Sphinx output is that
>> copy & paste of the examples is quite difficult, since you get
>> the >>> and ... prompts. This could be avoided with suitable HTML
>> magick.
>
> Maybe the wonderful %doctest_mode magic command of Ipython should be
> advertised somewhere... I use it all the time since I've discovered the
> feature, it's awfully convenient :D.

Thanks for answering for me :)

Regarding the advertising, I'll be the first to admit we could do
better.  But in our defense, it's at least documented:

http://ipython.scipy.org/doc/stable/html/interactive/tutorial.html?highlight=doctest_mode

http://ipython.scipy.org/doc/stable/html/overview.html?highlight=doctest_mode

http://ipython.scipy.org/doc/stable/html/development/overview.html?highlight=doctest_mode

http://ipython.scipy.org/doc/stable/html/api/generated/IPython.Magic.html?highlight=doctest_mode#IPython.Magic.Magic.magic_doctest_mode

Maybe ipython should open a twitter account with a tweet-tip
(tweetip?) of the day everyday :)

>> I think such a demo function could be easy to implement: just
>> pick up the doctest lines and run them. I think a IPython
>> extension could easily be written for this: just check what's in
>> the ipy_*.py files under IPython/Extensions and adapt one of
>> them.
>
>> There's a ready-made implementation of the doctest pickup in
>> plot_directive.py under numpy/doc/sphinxext.
>
> That's exactly the kind of hints I was looking for, many thanks! I'll
> have a look at the files you mention to see how it could be done.

And when you finish, send it our way.  Operators are standing by to
take your patch and your credit card number... :)

Take care,

f


More information about the Scipy-dev mailing list