[Edu-sig] [Ann] DocTest solution: Crunchy Frog

Andre Roberge andre.roberge at gmail.com
Fri May 5 04:31:32 CEST 2006


Version 0.2 of Crunchy Frog is ready to be released.

After refactoring the code in a major way, I have been able to
implement *almost* all the non-graphical features I was hoping for.

The code should now be very easy to understand, if you have some
familiarity with CherryPy and ElementTree.

Unfortunately, sourceforge appears to have been down for a while, so I
haven't been able to upload it.  If you want to try it, and can`t find
it on sourceforge, feel free to contact me by email and I'll send you
a copy.  The updated 5 html files and 3 Python files fit in less than
10 kB (zip file).

When you enter some Python code in an "editor area" and have Python
execute the code, the code no longer disappear from the "editor area".
This is the most important improvement, from a usability point of
view.

You can now also have an arbitrary combination of 'fake interpreter
prompt', 'editor area' and 'DocTest areas' on a single page.

The code that takes care of the execution of the user code has been
extracted and put in a small module on its own.  Therefore, whenever
one develops a "Python sandbox", it will be extremely simple to make
use of it.

There are three main features left to implement:

1. add the possibility to load "non-local" html files.  This might be
as easy as adding a couple of lines of code, using a module like
urllib.  When I figure out how to do that, I'll be pestering authors
of existing Python tutorials to adapt them for use with Crunchy Frog
;-)

2. Fix a major annoyance for "long" pages: at present, when executing
a code snippet, the page gets reloaded at the very top, even if the
"editor area" or "fake interpreter prompt" was at the bottom of the
page.  I haven`t been able to find out how to do this using CherryPy.

3. Being able to navigate in an arbitrary directory structure.  Up
until now, I have had problems if the html files were not all in a
single directory.

There are a few other features (like saving a session) that I would
like to ideally fix before version 1.0.

The usage I make of CherryPy appears to be extremely minimal.  I
suspect that someone familiar with web programming using the standard
library would be able to reproduce what I did without too much
programming efforts.  If anyone has any pointers as to how I could do
this, I would appreciate it.

As usual, any feedback including strong criticisms are welcome!

André

On 5/4/06, Andre Roberge <andre.roberge at gmail.com> wrote:
> Version 0.1 of Crunchy Frog has been released.  It can be found at
> https://sourceforge.net/project/showfiles.php?group_id=125834
>
> Crunchy Frog allows to transform a "traditional" Python tutorial into
> an interactive session within your favourite web browser.  Three
> "modes" of interaction are currently possible:
> 1. one-liner, similar to the typical instruction at the Python interpreter.
> 2. multi-line Python code, as entered in a traditional editor, and
> executed by Python.
> 3. Solutions to doctests, as described by Jeff Elkner in a previous post.
>
> Crunchy Frog is more of a proof-of-concept than a serious application
> at this point. The code is rather messy, showing my total lack of
> experience with this type of program (web app).  To use it you will
> also need to have installed Elementtree (included with Python 2.5?)
> and CherryPy.   You do not need to install Crunchy Frog.
>
> To try it: read the 5 (short) pages long "tutorial" included, using
> your favourite browser.  Then, start Crunchy Frog, and go through the
> tutorial again.  The whole thing should be doable in less than 10
> minutes.
>
> André
>


More information about the Edu-sig mailing list