python

web.py goes into public domain

Aaron post to the web.py’s mailing list last night telling that he will put web.py into public domain. A while back ago, he put a poll on what license web.py should be put under. The original license was Affero General Public License, a modified GPL which put another clause requiring any software accessible through a computer network that provide a facility to download the source code, so the derivative work from that software must not remove the same facility. That means everyone who use web.py to develop wep application must also offer their source code alongside since web.py itself has such a facility.

This goes into quite lengthy discussion on the mailing list, mostly on the incompatibality of AGPL with GPLv2 and also the fact that you need to offer sources for any web application you have develop and put it up on the Net. Doesn’t sound like a good idea if you want to propose web.py to your boss or client. While Aaron did offer for anyone who want alternative license for their app to ask him personally, discussion continue on the applicability of AGPL.

To the question on why not putting it under the standard Python license, Aaron replied with:-

I’m opposed to the confusing proliferation of licenses. Python’s had at least three different licenses over its lifetime, all of which have a bunch legalese and complicated clauses, none of which have anything to do with protecting users. Explaining public domain, by contrast, couldn’t be clearer — do whatever you like with it.

which I fully agree that in some cases, license has become someone’s political agenda rather than technical improvement of the code. I hate office politic and I’m not going into another software politic. And on some remark that Public Domain would discourage community involvement:-

I don’r really like the taste of “PD”. Most projects that i remember (back in those days of the amiga) that have been PD have been one-man shows. I would prefer to stress the community aspect and that web.py has a real “home” where peolple come together to contribute and to improve. - jemi #

Aaron replied:-

I hope that web.py is a community where people come together. I can’t really argue against your impressions of things, but in reality if web.py was copyrighted that would mean that anyone who contributed would have to assign their copyrights to me personally. If it’s public domain, they simply need to release them to the community. That seems a lot more community-encouraging to me.

This is a very nice gift from Aaron to the community, and me ;) and from the recent post to the thread, I knew that sqlite is one of the successful software project which was put under Public Domain. I wish the same success to the web.py community.

colubrid, lightweight wsgi request handler

I was in a good mood when found the link to colubrid while doing my routines on Planet Python. Yes, yes … another framework ;)

Colubrid is a WSGI request handler which simplifies python web developement.

If you’ve ever created a WSGI application without an framework or an request handler you know how stupid this can be.

I’d quickly go through the documentation and had some good feeling about it. But it just a feeling, nothing more. Being working on my own ‘framework’ (what !!! ?), look’s like the author’s goal quite similar to mine. And it was released under GPL. worth checkout, tommorow, sure. Now I need some sleep.

ORM: Don't reinvent SQL !

Reading this blog post, Why schema definition belongs in the database I fully agree what the author said. Pretty much what I’m thinking lately about the state of ORM in python world. Look’s like everyone trying to shoot off SQL and be it all python. Just look into the django, one of the major drawback which keep me away from it is the model where you have to specify in Python. I love python either but that does not mean everything should be in python. I’ve spent a lot of time learning sql and now I have to learn again how to define it in python. That’s still ok but what I really don’t like is the redundant definition of your schema. Your database schema is well defined within the SQL so there’s no point to redefine it again in your model. Python crowd would argue that “Explicit is better that implicit” but IMO, this does not apply to SQL.

Back to the days when I’d involved in writing ORM in PHP, one of our goal is to reduce the probability of introducing error in the various layer of the application. Sort of error such as validating form field to not exceed than 5 while in db it suppose to be 4 and other bugs relating miss match between the application and db. So one of the ORM goal is to pull everything from the db. The db is your application. Everything is well defined there and if you make any changes it will reflected to the whole application. Changing column lenght in db would update the column attributes in model and also change the form size together with it’s validation rule. The models, most of the time would only contain a reference to the db table and probably some validation method.

class Node extends db_table {
    table_name = 'Node'

    function validate() {
        //your validation logic
    }
}

Most of the ORM tools in Python except django models support certain degree of introspection into db. For example, in sqlobject if you do not want to define the model in python:-

class Node(sqlobject):
    class sqlmeta:
       fromDB = True

SQLAlchemy also provide introspection into the db and based on first glance through the documentation look’s much better and native compared to sqlobject which I guess preferred to define the model in python. IMO, defining the model in your code just introduce another problem. Now you have to maintain the definition in two place. Every time you changed the db, you have to go through all the models and change it as well. It’s not too hard if you only have a few tables but if it count to hundred or more, you can guess it. I’ve gone through this before.

However, it’s look’s like most of the python major frameworks such as django and turbogear preferred to define the models in python rather than pulling it directly from database.

In search of phphtmllib like library, in python

My search for a html library like phphtmllib in python yield some better results compared to the past time. I thought I’d still used the same keyword. This is a little bit about phphtmllib:-

A set of PHP classes and library functions to help facilitate building, debugging, and rendering of XML, HTML, XHTML, WAP/WML Documents, and SVG (Scalable Vector Graphics) images as well as complex html ‘widgets’.

Some simple usage:-

$page = new HTMLPageClass('Hello')
$page->add(html_h1('hello world'))
print $page->render()

It means we can produced HTML directly from php, OO fashion and nicely indented output. All HTML tag were php objects and it also provide a list of helper function that returns the php objects, such $p = html_h1() is similar to $p = new HTMLTagH1. That just for illustration, I’d forgot the exact class name. While at my previous job, we heavily used this library in our application and it proves to be powerfull and flexible approach especially when dealing with a very complex forms. We also use template before that, so we know the difference between both approach. Nuff said about that.

Now I want the same thing in python. The closest one is HTMLgen but it’s not maintained anymore. Look’s like the python community not really interested in a library like this. Probably they have some better ways but I love this approach. So, when I searched about it again, I found these two library:-

  • pyhtmloo - http://pyhtmloo.sourceforge.net/
  • pyweb - http://www.freenet.org.nz/python/pyweb/

The author of pyhtmloo even mentioned that he was inspired by phphtmllib. The sad part is both were not actively developed anymore based on the recent release which was in 2003. So if any of you (who read this) knows something about the existence of such library in python, I beg you, please let me know. Just don’t let me port phphtmllib to python. The desire is height, I just need to learn python :-)

Update

Stan from Nevow projects look’s interesting. It’s just based on reading this article:- http://www.kieranholland.com/prose/meet-stan/

damn … I’d even forgot to put semi-colon at the end of my php script ;-)

simple blog in webpy, learning python the fun way.

So, if harry created a simple wiki, now I created a simple blog using web.py. It turns out to be a very fascinating moment for me. The feelings just like the first time I wrote my php script. While I’m not sure whether webpy would be the right platform for me to develop application in python, it sure have let me learn python in the fun way. Good work aaron !

As usual, I’ve put the whole code in the wiki. Please note that the code was extremely simple, just to see if it’s work. The template was a mess. No need to say how much I hate template. Cheetah probably has some way to organize template but I don’t even looked at their documentation. Should I say again that I hate template :-)

web.py, python web framework

You might say, another one ? but this one really caught my attention when I found about it sometimes ago during my search for html library in python. So when harry fueck blog about a simple wiki with webpy, I don’t hesitate to try it out. webpy was created by Aaron Swartz. As he pointed in rewriting reddit, webpy was a result of his frustration with django. It’s already used in production by reddit.com who rewrote their website in python from lisp ? I always have a dream of writing web application in python but the problem is there were 100 ways of doing it. Most that I have tried were complicated which made me stopped half of the way thinking that it’s not worth. webpy seem’s promising. I’m not depth into it yet but aaron might be in the right direction.

I got some problem setting up webpy as FastCGI through lighttpd and after few emails with aaron, I managed to get it work. I have put it in my wiki - http://www.k4ml.com/wiki/python/webpy.

Syndicate content