Monday, July 09, 2007

New Crunchy (0.9) is out

By now, the official announcement should have made it to many lists. After a mad rush of coding and writing documentation over the past week or so, and implementing lots of new cool features, the new Crunchy is officially taking over from the old one.

I believe that this new version can do much to promote Python usage. If you do agree, please mention it!

Here's a copy of the announcement I sent to various lists:

Crunchy 0.9 has been released. It is available at http://code.google.com/p/crunchy

What is Crunchy?

Crunchy is a an application that transforms html Python tutorials into interactive session viewed within a browser. We are not aware of any other application (in any language) similar to Crunchy. Currently Crunchy has only been fully tested with Firefox; we know that some browsers simply don't work with it. Crunchy should work with all operating systems - it has been tested fairly extensively on Linux, Windows and Mac OS.

What is new in this release?

Crunchy has been rewritten from scratch from the previous version (0.8.2), to use a custom plugin architecture. This makes easier to extend and add new functionality. Rather than list the differences with the old release, it is easier to list the essential features of this new version.

1. Crunchy can work best with specially marked-up html tutorials. However, it can now work with any html tutorials - including the official Python tutorial on the python.org site. Html pages can be loaded locally or remotely from anywhere on the Internet. Crunchy uses a combination of Elementtree and BeautifulSoup to process html pages. Non W3C-compliant pages can be handled, but the visual appearance is not guaranteed to reproduce that normally seen using a browser.

2. Crunchy can insert a number of Python interpreters inside a web page. In the default mode, it does that whenever it encounters an html [pre] element which is assumed to contain some Python code. These interpreters can either share a common environment (e.g. modules imported in one of them are known in the other) or be isolated one from another.

3. Crunchy adds automatic css styling to the Python code - you can look at the official Python tutorial using your browser (all Python code in blue) and compare with what Crunchy displays to give you a good idea.

4. Instead of inserting an interpreter, Crunchy can insert a code editor that can be used to modify the Python code on the page and execute it. The editor can be toggled to become a fairly decent syntax aware editor that can save and load files.

5. Crunchy has a "doctest" feature where the code inside the [pre] is taken to be the result of an interpreter session and the user has to write the code so as to make the interpreter session valid; this is useful in a teaching environment. Messages from the Crunchy's doctest are "friendlier" for Python beginners than the usual tracebacks.

6. Crunchy has a small graphics library that can be imported, either inside an editor or an interpreter, to produce simple graphics (even animations!) inside the browser.

7. For the user that needs better quality graphics, Crunchy supports programs (such as matplotlib) that can create image files; by executing the code, the image produced is loaded inside the browser window. In this capacity, Crunchy could be used as a front end for libraries such as matplotlib.

8. Crunchy supports code execution of files as separate processes, making it suitable to launch gui based application from the browser window.

9. Crunchy's interpreter has an interactive "help" feature like many python-aware IDEs.

10. Crunchy includes a fairly comprehensive tutorial on its own use, as well as a reference for tutorial writers that want to make their tutorials "crunchy-friendlier".

11. As a security feature, crunchy strips all pre-existing javascript code from an html page before displaying it inside the browser window.

Bug reports, comments and suggestions are always welcome.

André Roberge, for the Crunchy team.

7 comments:

Paddy3118 said...
This comment has been removed by the author.
Paddy3118 said...

Oh gosh! Truly wonderful!
I've only used it for fifteen minutes, went and re-visited my blog at paddy3118.blogspot.com and the results were amazing.

You might want to add a button in the remote_en.html file that would allow one to switch on the ability to load code into the editor by default; without having to restart the application.

The install was a doddle. The README file succinct and a p$*ce of p*ss to get going. Click on a file and its up and running (Windows-XP, Python 2.5).

Ta very much. Paddy.

André said...

You should not need to restart the application to load code in the editor by default. You should be able to enter
crunchy.no_markup = 'editor' inside any interpreter prompt and the switch will be made. All you have to do to see it is *reload* the page.

Btw, if you are on a page where an editor is, you can type in the same command and execute it - it should yield the same result.

Finally: if you're happy with it, spread the word on your blog ;-)

Paddy3118 said...

Consider the word spread :-)

- Paddy.

P.S. Maybe you could add an 'I've been Crunched!' logo and docs to the home site giving instructions on how people can add a permanent visible logo to their sites that would indicate that the page is prepared with Crunchy in mind, and an image link back to the Home site telling the curious what Crunchy is about?

André said...

I was thinking of using the Crunchy Python logo for indicating that a site has been prepared for Crunchy - but I'm still waiting for a copy of the logo with the right font from someone from the Python Software foundation (they agreed in principle ... but I'm still waiting...)

Here's the first time I mentioned the idea.

usagi said...

Why dont you release crunchy as an Egg so that people can install it with easy install?

André said...

We're looking into that (python eggs) as well as using py2exe + installer on Windows, some Linux solution and py2app for Mac. Hopefully this will be done by release 1.0 - if not sooner.