LWN: Comments on "Pyjamas: writing AJAX applications in Python" https://lwn.net/Articles/348341/ This is a special feed containing comments posted to the individual LWN article titled "Pyjamas: writing AJAX applications in Python". en-us Fri, 19 Sep 2025 07:10:26 +0000 Fri, 19 Sep 2025 07:10:26 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/471083/ https://lwn.net/Articles/471083/ AvdN <div class="FormattedComment"> I am not sure where the original 23K comes from. The example/timesheet directory has 1504 lines in .py files. <br> The resulting .js closer to 5K lines and the .html 42K for each of the supported browsers. But the latter two are IMHO non-important.<br> </div> Thu, 08 Dec 2011 07:16:00 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/362038/ https://lwn.net/Articles/362038/ foom <div class="FormattedComment"> <font class="QuotedText">&gt; this is a standard well-known, well-understood problem associated with ALL ajax applications</font><br> <p> So, then, why isn't it well-known and well-understood that you should not use an AJAX <br> application where a standard HTML page is easier to create, more functional for users,<br> and better in every possible way (such as presenting static documentation)?<br> <p> <font class="QuotedText">&gt; if you want me to create a special "PDF" button so you can download the same material for</font><br> <font class="QuotedText">&gt; your convenience, *pay me*!</font><br> <p> No, I think he wanted a nice, simple, *non-ajax* normal webpage. Then he could've simply used<br> the browser's save menu option.<br> <p> </div> Mon, 16 Nov 2009 05:01:51 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/362025/ https://lwn.net/Articles/362025/ lkcl <div class="FormattedComment"> "Like GWT, the documentation is in a book reader ("bookreader" means it is an AJAX reimplementation of static HTML -- so you get static pages, but search engines can't index it"<br> <p> this is a standard well-known, well-understood problem associated with ALL ajax applications. as an AJAX developer, you will know this, and will have catered for it by providing HTML "alternative" pages, usually enclosed in &lt; noscript &gt; tags, along with a "redirect" to the AJAX equivalent so that any search engine people who see the "redirect" can see that the HTML "static" page looks identical to the AJAX equivalent, and don't cut your site off from the search engine. this problem has NOTHING to do with pyjamas, and EVERYTHING to do with AJAX. regardless of the AJAX framework chosen, be it GWT, DoJo, extjs, prototype - whatever: you WILL have to deal with this issue, period.<br> <p> "you can't easily download it for off-line viewing"<br> <p> it's a demo app, created by a free software developer (me), unpaid, in their free time - what do you expect, miracles? if you want me to create a special "PDF" button so you can download the same material for your convenience, *pay me*!<br> <p> honestly, some people :)<br> <p> "It wasn't compatible with the old Firefox we had there. I tried viewing them in the latest Opera at home. No go on the compatibility front"<br> <p> where's the bugreport? did you raise a bugreport?<br> <p> <p> "It brags that it cut GWT's 80,000 lines to 8,000 lines, but it appears to have lost a lot of the functionality of GWT in the process. Part of this is that it is a thinner layer than GWT, but a big part of it is that it cut important things".<br> <p> and? so? pyjamas does what the developers who CONTRIBUTE to it want it to do. if you don't like what it provides, *contribute*, don't complain. you can contribute in two ways to this unpaid and community-driven project: 1) code 2) money.<br> <p> 80,000 lines of code means that a team of engineers working round-the-clock, full-time, is required, and those engineers have to be paid money. a large corporation like google can sink large amounts of money into GWT.<br> <p> by contrast, pyjamas is a community-driven effort.<br> <p> "Pyjamas done right (which may happen in a year or two) would be sweet."<br> <p> 1) complaining and stating that pyjamas "isn't right" just because it doesn't do everything YOU want it do doesn't help, and is factually incorrect. pyjamas is quotes right quotes for those people who choose to work with it.<br> <p> 2) if it's "not done right", provide some code, or some money, to make that happen. otherwise, please do stop accusing the developers of having "done it wrong", and be grateful for what you get.<br> <p> <p> <p> </div> Sun, 15 Nov 2009 19:02:22 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/361948/ https://lwn.net/Articles/361948/ pm101 <div class="FormattedComment"> GWT is great, but I hate Java, so I spent a while messing with Pyjamas today. It is not ready for primetime. I'll give an example. Like GWT, the documentation is in a book reader ("bookreader" means it is an AJAX reimplementation of static HTML -- so you get static pages, but search engines can't index it, you can't easily download it for off-line viewing, and the interface to the web browser is off in little ways). I tried viewing the docs at work. It wasn't compatible with the old Firefox we had there. I tried viewing them in the latest Opera at home. No go on the compatibility front. Finally, I used a recent Firefox, and it worked. <br> <p> It brags that it cut GWT's 80,000 lines to 8,000 lines, but it appears to have lost a lot of the functionality of GWT in the process. Part of this is that it is a thinner layer than GWT, but a big part of it is that it cut important things. <br> <p> It's a pity. Pyjamas done right (which may happen in a year or two) would be sweet. I'd love to replace JavaScript with a language that doesn't suck. <br> </div> Sat, 14 Nov 2009 12:22:05 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/350503/ https://lwn.net/Articles/350503/ tjc <blockquote type="cite">This, to me, is a hell of a lot better then requiring ;'s all over the place. I tend to forget those time to time and it's sometimes very irritating to track that down.</blockquote> Semicolons are optional in Javascript, so why bother to "track that down?" If you don't like them, then just leave them off. Thu, 03 Sep 2009 04:28:05 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/349845/ https://lwn.net/Articles/349845/ kleptog Actually, python's scoping is one of my biggest problems. The fact that the scoping of a variable can change in odd ways. Consider: <p><pre> import time def main(): print time.clock() time = 1 main() </pre> This program produces an error on the "print" line, yet if you comment out the "time = 1" line it works. This means you have to read a whole function before you can determine the scope of a variable. Being someone who controls scopes carefully so that typos are more easily found, it all feels weird. Sun, 30 Aug 2009 13:18:55 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/349767/ https://lwn.net/Articles/349767/ lkcl <div class="FormattedComment"> "but I can't imagine that automated compilation of arbitrary Python libraries into JS+HTML is feasible, "<br> <p> into HTML? no. into javascript? yes. that's exactly what pyjamas does, and it's also what skulpt is aiming for, and it's exactly what the pypy project aimed for, except they gave up.<br> <p> the tricky bit is doing it _efficiently_. we decided that that was a bad decision to enforce onto people, so we decided to offer two options: -O and --strict. they do exactly what you'd expect.<br> <p> </div> Sat, 29 Aug 2009 12:14:44 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/349757/ https://lwn.net/Articles/349757/ lkcl <div class="FormattedComment"> "I quite disagree: Javascript has a few warts, but it's quite elegant at its core, and very powerful."<br> <p> oo, absolutely! think about this: an implementation of python classes - dynamic multiple inheritance including superclasses and the (very rarely used and misunderstood _three_ arguments to the type() function: kls = type("ClassName", [Baseclass1, Baseclass2], {'method1': fn })...<br> <p> ... that can be implemented in UNDER 100 lines of javascript!<br> <p> there's a little trick to do "object-like" inheritance which is typically deployed in javascript frameworks: it creates a new Object() and then sets up the prototypes copying them from the base object. that's typically implemented in about... 15 lines of javascript. all we did was expand that a little bit further.<br> <p> voila. instant emulated multiple inheritance and python superclasses.<br> <p> the warts: achhh. anonymous objects that don't carry around the "this" pointer properly. having to create a wrapper function which re-associates the .... never mind :)<br> </div> Sat, 29 Aug 2009 11:24:24 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/349752/ https://lwn.net/Articles/349752/ lkcl <div class="FormattedComment"> "This is the information that was missing from the article (at least for me)."<br> <p> yehhh, it's tricky to cover a comprehensive topic, and often it's interactive discussion that works better for some (hellooo :)<br> <p> "Well, actually quite a bit of money is spent on the support..."<br> <p> oh dear! try <a href="http://siriusit.co.uk">http://siriusit.co.uk</a> they actually employ or have contacts with many of the developers who work on products that their customers deploy, such as postgresql, kde, samba etc. unfortunately, with google's policy of employing many of the worlds' top free software developers (so that nobody else can) it's a quite a hard trick for any support company to pull off.<br> <p> "you should be grateful that google released GWT as free software<br> <p> I don't feel like, because I hope I never have to use it, neither as a developer or a user. Web-based UIs (in my experience) suck, regardless of the technology behind them. "<br> <p> *rueful smile* you're not the only person to be utterly disillusioned with web-based UI development. this is one of the reasons why i risked creating and emphasising pyjamas-desktop, because by going "direct" to the DOM model and cutting out the javascript, one of the main painful psychological barriers (javascript) is lifted.<br> <p> the skills list required to do decent web-based user interfaces is just absolutely horrendous. i listed them only last week: <a href="http://advogato.org/person/lkcl/diary/623.html">http://advogato.org/person/lkcl/diary/623.html</a> - many people simply cannot cope with this, in order to create the level of UI interaction experience that web users expect these days.<br> <p> anyway - it's particularly interesting to note that john resig, an experienced javascript developer, criticises pyjamas from a different angle: one of not being "direct" enough. but the thing is, the whole point of the pyjamas UI API is to solve and encode as many of the quirks and the bits of expertise as possible behind a common API so that _you_ don't have to know them. [that's the job of AJAX frameworks: it's just that pyjamas is written (mostly) in python, not javascript]<br> <p> both GWT and Pyjamas do that: one for java developers, one for python developers. (there's also RWT (RubyJS) but its development stopped in 2007 unfortunately).<br> <p> the point is: myself and many others have been just as exasperated and disillusioned as you, with web UI development (i vowed once that i would never do javascript programming, now i'm doing the complete opposite!) and both GWT and Pyjamas tackle UI development with less emphasis on "web", more emphasis on "desktop-widget-like", and thus allow us to carry on, keep abreast of current user expectations, not give up and not go bananas with stress either :)<br> <p> </div> Sat, 29 Aug 2009 11:17:27 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/349732/ https://lwn.net/Articles/349732/ SteveAdept <div class="FormattedComment"> Add me to the list of people who don't like Javascript. My primary peeve is how it represents null values, similar to the mess PHP makes of it. If I never initialized a variable before I start reading from it, I want to know about it. Ick. I find that it often makes debugging extremely frustrating for me.<br> <p> And I realize this isn't specifically a language issue, but I hate the fact that we have to deal with so many different implementations. I'm spoiled by the ubiquity and consistency of CPython, I guess.<br> </div> Sat, 29 Aug 2009 05:44:39 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/349523/ https://lwn.net/Articles/349523/ NAR <I>that is exactly why</I> <P> This is the information that was missing from the article (at least for me). <P> <I>welcome to free software! did you pay money for any of that infrastructure? so - you got what you paid for.</I> <P> Well, actually quite a bit of money is spent on the support... <P> <I>you should be grateful that google released GWT as free software</I> <P> I don't feel like, because I hope I never have to use it, neither as a developer or a user. Web-based UIs (in my experience) suck, regardless of the technology behind them. Fri, 28 Aug 2009 13:36:02 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/349529/ https://lwn.net/Articles/349529/ lkcl <div class="FormattedComment"> "Something like xul, what a relief."<br> <p> yes - in fact, one of the ports of pyjamas to the desktop actually uses xulrunner. the xulrunner port is the most stable of the three: the MSHTML one has a couple of keyboard-event-related niggles, and the webkit one, one of the developers is being a bit of a twat. if you're interested in the pyxpcomext glue - in how pyjamas desktop joins up with xulrunner, or if you're interested in writing your own declarative pyxpcomext application, here's an article which explains it:<br> <p> <a href="http://pyxpcomext.mozdev.org/no_wrap/tutorials/hulahop/xpcom-hulahop.html">http://pyxpcomext.mozdev.org/no_wrap/tutorials/hulahop/xp...</a><br> <p> this is a quite different - and i believe much simpler - approach than "standard" pyxcpomext apps, where you have to "register" your app with the mozilla xpcom infrastructure, then create a xulrunner shellscript wrapper (based on run-mozilla.sh) in order to start up the app - it's just such a pain (but has distinct advantages).<br> <p> personally i much prefer to start from the python prompt, and the article above explains how to do exactly that.<br> </div> Fri, 28 Aug 2009 12:17:40 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/349518/ https://lwn.net/Articles/349518/ lkcl <div class="FormattedComment"> yes i didn't know that this article was going to be written - i added some extra lines to the helloworld example and accidentally committed them, when testing some CSS styles on buttons and also testing the getModuleBaseURL function.<br> <p> the original helloworld app was 8 lines long, and you can see it here:<br> <p> <a href="http://pyjs.org/book/output/Bookreader.html#Getting%20Started">http://pyjs.org/book/output/Bookreader.html#Getting%20Sta...</a><br> <p> </div> Fri, 28 Aug 2009 10:33:35 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/349515/ https://lwn.net/Articles/349515/ lkcl <div class="FormattedComment"> "My experience with generated code is "all is well until the first bugreport". Usually the bugreport mentions parts (stack traces, line numbers, etc.) from the generated code - how do you get back from that to the code you've written?"<br> <p> that is exactly why:<br> <p> 1) we added a debugging system which keeps track of the current line number and even optionally includes the python source code line _in_ the javascript, so that during development you can get a full python stack trace - WITHOUT having to have any javascript debugger installed.<br> <p> 2) i went to all the trouble to create pyjamas-desktop, so that you would be able to run the exact same application under the standard python interpreter.<br> <p> "Not to mention that the code generating can introduce errors on its own."<br> <p> this is a matter of trust. you place your trust in the tool that it is going to do the job. just as you trust any other tool to do its job. to back up that trust, we always add a regression test whenever a new feature is added, and i've been pushing to have regression tests added whenever someone reports a bug, too, to demonstrate the missing feature. <br> <p> lovelysystems are also working quite hard to make the python-to-javascript compiler pass the _standard_ python regression tests, from a command-line version that is combined with spidermonkey, and i've added experimental support for python-spidermonkey and pyv8, as well. this is a similar goal to what skulpt are aiming for.<br> <p> "Nowadays I spend most of my time chasing bugs in (open source) infrastructure code that should work (but doesn't), so I'd be cautious about adding any extra layers..."<br> <p> welcome to free software! did you pay money for any of that infrastructure? so - you got what you paid for.<br> <p> pyjamas, like any free software project, does the job that the people who are *working on it* want it to do. everyone else who is NOT contributing is getting the [free] benefits of their efforts and expertise.<br> <p> you should be grateful that google released GWT as free software; grateful that james tauber did the port to python, and grateful that the current developers continue to maintain it and release their contributions to the wider world.<br> </div> Fri, 28 Aug 2009 10:29:30 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/349495/ https://lwn.net/Articles/349495/ niner <div class="FormattedComment"> Open brackets or braces can extend an expression to multiple lines. And that is a very <br> good thing, otherwise it would make code quite unreadable. The ''' or """ quotes do the <br> same.<br> <p> But both mean that you cannot simply trust a statement to be a single line of code.<br> </div> Fri, 28 Aug 2009 07:12:47 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/349119/ https://lwn.net/Articles/349119/ hppnq That "Hello World" strikes me as very ugly, and a 23k line timesheet application makes me shiver. (A one page Gmail client?!) It looks to me that this is especially appealing to developers who simply want to develop in Python, and not in javascript and HTML. Fair enough. <p> But the main attraction of running code unadapted on the desktop and in a browser is the abstraction of the language. Technically these things are not extremely challenging; you can (already) develop, run and debug javascript on your desktop, with or without a browser. But being able to write things like <p><code><blockquote> &lt;window&gt;&lt;button/&gt;&lt;/window&gt; </blockquote></code><p> and run it in a browser, or from the desktop, or in your head -- that is something completely different. Something like xul, what a relief. Thu, 27 Aug 2009 15:15:05 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/349110/ https://lwn.net/Articles/349110/ NAR <div class="FormattedComment"> My experience with generated code is "all is well until the first bugreport". Usually the bugreport mentions parts (stack traces, line numbers, etc.) from the generated code - how do you get back from that to the code you've written? Not to mention that the code generating can introduce errors on its own. Nowadays I spend most of my time chasing bugs in (open source) infrastructure code that should work (but doesn't), so I'd be cautious about adding any extra layers...<br> </div> Thu, 27 Aug 2009 13:38:13 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/349053/ https://lwn.net/Articles/349053/ flewellyn <div class="FormattedComment"> I quite disagree: Javascript has a few warts, but it's quite elegant at its core, and very powerful.<br> <p> Namespaces might be of use, but you can use objects to handle them easily enough; the variable scoping rules are only a problem if you don't understand closures (which are one of the things that gives JS such power), automatic semicolon placing...yeah, that sucks, so I don't rely on it. I always use semicolons.<br> <p> The main thing I dislike about Javascript, the language, is the overloading of + to mean "addition" and "string concatenation". Operator overloading is never a good idea, especially in this case, because JS is dynamically typed, and numeric values may be misinterpreted as strings.<br> <p> I think JS gets a bad rap because people are used to dealing with DOM incompatibilities, and blame those on the language.<br> </div> Thu, 27 Aug 2009 05:24:18 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/348994/ https://lwn.net/Articles/348994/ gouyou <div class="FormattedComment"> I didn't like JavaScript up to the point I read "JavaScript: The Good Parts" from Douglas Crockford. This book was a revelation for me. (If all languages would have such a book, it would make learning new language for people with already a bit of programing experience much simpler.)<br> </div> Wed, 26 Aug 2009 23:43:35 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/348979/ https://lwn.net/Articles/348979/ quotemstr Yet it has lexical closures, which somehow most languages seem to relax. Closures are Javascript's saving grace; with them, most of your other concerns can be addressed. <p> (Well, and <b>never</b> using the scope-destroying, mind-liquefying, optimization-prohibiting <a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Statements/with"><code>with</code></a> facility.) Wed, 26 Aug 2009 22:10:37 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/348974/ https://lwn.net/Articles/348974/ drag <div class="FormattedComment"> <font class="QuotedText">&gt; because they not only both have error-encouraging scoping and line </font><br> termination rules,<br> <p> What? <br> <p> I don't understand. The line termination rules for python is very simple.. <br> A line of code ends with a newline. The only exceptions that I can think <br> of to this is that you can explicitly end a line of code with ";" and you <br> can extend a mathematical statement by enclosing it in ().<br> <p> This, to me, is a hell of a lot better then requiring ;'s all over the <br> place. <br> I tend to forget those time to time and it's sometimes very irritating to <br> track that down. In python as long as I keep my code clean and line <br> lengths to under 80 characters (or so) then it's easy to know what a line <br> of code is just by looking at it. A line of code is a line of text.<br> <p> <p> And what is error prone about Python's scoping? I can't imagine that its <br> any worse then C++ or C or Java or anything like that.<br> </div> Wed, 26 Aug 2009 22:07:21 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/348961/ https://lwn.net/Articles/348961/ iabervon <div class="FormattedComment"> The scoping and line termination rules, combined with being interpreted at runtime, make a large portion of bugs difficult to detect without actually reaching every line of code.<br> <p> Of course, Python has the same problem as Javascript here, but it's more than twice as bad if you're doing a project with both, because they not only both have error-encouraging scoping and line termination rules, they have different rules. So the Python you're writing encourages you to accidentally make your Javascript variables global and forget required semicolons.<br> <p> </div> Wed, 26 Aug 2009 21:14:31 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/348962/ https://lwn.net/Articles/348962/ jake <div class="FormattedComment"> <font class="QuotedText">&gt; What distro were you running this on?</font><br> <p> Fedora 10, but that doesn't really matter as I just grabbed the 0.6 tarball and played with that.<br> <p> jake<br> </div> Wed, 26 Aug 2009 21:09:51 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/348950/ https://lwn.net/Articles/348950/ days_of_ruin <div class="FormattedComment"> What distro were you running this on?<br> </div> Wed, 26 Aug 2009 20:40:08 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/348941/ https://lwn.net/Articles/348941/ Cyberax <div class="FormattedComment"> JavaScript is extremely cludgy language. It has no namespaces, idiotic variable scoping rules, absolutely moronic automatic semicolon placing, etc.<br> <p> See this presentation: <a href="http://googlecode.blogspot.com/2009/03/doug-crockford-javascript-good-parts.html">http://googlecode.blogspot.com/2009/03/doug-crockford-jav...</a><br> </div> Wed, 26 Aug 2009 19:30:57 +0000 Pyjamas: writing AJAX applications in Python https://lwn.net/Articles/348904/ https://lwn.net/Articles/348904/ nye <div class="FormattedComment"> This sounds like an excellent project, mostly because it's a) retargetable (running the same code as a desktop application is a nice trick) and b) handles "the various tricks needed to make an application work consistently across multiple browsers, all of which must be wrapped up inside HTML".<br> <p> What I don't get is why it's so fashionable to add bits like "the clumsiness of the Javascript language itself". Javascript is probably my second favourite programming language (after Lua, which I sadly find too little opportunity to actually use). Usually when people deride Javascript it turns out they are actually talking about, say, inconsistent event handling across browsers, or implementation bugs like IE's memory leaks when closures are used in particular ways - or other problems which really are in no way part of the 'language itself'.<br> <p> I do write a fair bit in Python, because of the broad array of libraries available, but I can't imagine that automated compilation of arbitrary Python libraries into JS+HTML is feasible, so this seems to take away most of Python's appeal. Nevertheless I'm sure I'll give it a try some time...<br> </div> Wed, 26 Aug 2009 17:59:02 +0000