Thom Nichols

Thom

Technology is evolution outside the gene pool

Introducing the Python Web Console

I'd like to show off my latest project - the Python Web Console!

It's inspired by sites like the Groovy Web Console and TryPython.  Since I teach a Python programming class, I wanted to create an application for my students to experiment and share scripts they write. 

Ironically, the site is written using Java (not Python) for Google AppEngine.  The reason for this is, I've been told it's a bit tricky to sandbox Python code, whereas I know it's fairly straightforward in Java.  So Jython takes the reins     as script interpreter while preventing interpreted code from affecting the application.  You can find the entire project on GitHub.   

Some Highlights

  • Evaluate and publish Python code   
  • Atom feeds for published scripts, optionally filtered by tag
  • Edit, run, and comment on others' published scripts.
  • REST-like design, using YUI2 and Ojay on the client-side.   

Some Technical Notes

Python makes for much cleaner code, especially when it comes to templating.  I would have preferred to write the application using Gaelyk, but using Groovy to run Jython to interpret Python would have made the irony meter explode.  I still think I prefer plain JSP to JSF, although I agree with Matt Raible's sentiment that EL output should be escaped by default.  I wrote a couple EL functions to take some of the pain out of JSP, although as a templating framework JSP still has a few significant drawbacks.  (Which would explain why nobody uses JSP anymore). 

I'd also consider using a proper REST framework (and real JSON library and probably FreeMarker for HTML templating) if the app became anymore complex.  Spring's REST support looks good, and with Spring I get DI, scoping and easier configuration too.  Again, if my web.xml file got anymore complex, I'd want to move to a more sophisticated solution.  I also need to see if I can practically add memcache support, both for markup output and maybe script caching as well.  

Finally...

There are a few minor features that I'd like to complete, but for the most part the application is at a good "1.0" state.  Give it a try and let me know what you think!

   

(Comments are closed)

5 Comments

  1. avatar Re: Introducing the Python Web Console March 23, 2010 Matt Lachman

    I love the "suckless.tld" in the web xml.  Very nice.  :)
  2. avatar Re: Re: Introducing the Python Web Console March 23, 2010 Thom

    The description explains it all:

    <description>Various attempts at making JSP suck 
    less</description>

    So the name is perfectly appropriate :)

  3. avatar Re: Introducing the Python Web Console March 23, 2010 Randy Aldrich

    Sweet man.  Color me impressed.

    First time on your Bloog site.  I think you were using Blogger before? can't remember...

    Anyways, very slick.  I might play around with Bloog myself, been wanting to experiment with the app engine, this seems like a good entry point.

    Quick question.  Any reason you disabled comments on this post?

  4. avatar Bloog vs Blogger March 23, 2010 Thom

    Thanks :)  Blogger can only get one so far, and it's almost easier to customize code than it is to configure Wordpress.  Plus hosting is free on AppEngine unless you get a lot of traffic.

    As for that other post, comments automatically close after a certain # of days.  I should change that considering the small number of visitors I get.

  5. avatar New version March 24, 2010 Thom

    Check out my latest release with live syntax highlighting in the editor!

    http://test-3-codemirror.latest.pythonwebconsole.appspot.com/