November 23, 2008

Spring Python isn’t a simple port of the Spring Framework

Filed under: java, python — gregturn @ 4:49 am

While surfing across Google, I spotted a conversation where a couple guys were commenting on Spring Python. The only commentary was based on the Wikipedia entry, and showed no delving into official documentation or our website. Well, I can’t help but respond to the some of the assumptions that were made.

Spring-Python. A port of the Spring framework to Python. It’s like people haven’t read http://tinyurl.com/3jv3m

Uhh, I HAVE read Python is Not Java. In fact, I found it soon after I started this project, and took many of the points they were making to heart. If you look at the code, you will notice that a) there aren’t getters and setters all over the place typically found in Java, and b) I cleaned up the code base to better conform with PEP-0008. I have had other pythonistas look at my code and give me feedback so I can make this project as pythonic as possible.

That is, of course, a little unfair. They might be writing it in a Pythonic style. But still, aren’t there enough web frameworks?

Thanks for sticking up for me. I certainly appreciate that. And to clarify, yes, I am trying to writing this in a pythonic fashion. That is why I welcome other pythonistas to visit my code and seeing what I’m doing. Please send me patches or comments. However, please understand that Spring Python is NOT purely a web framework! This must one of the most frustrating things for the Spring folks. Spring MVC and Spring Web Flow may be web frameworks, but the whole framework isn’t just for web apps. In my daytime job, I use Spring all the time while NOT writing a web app! The stuff they have written is universal. Web app or not, there is good leverage inside their code, and I wanted the same power when writing python apps.

And reading the definitive source (Wikipedia, natch), I don’t see anything in there that isn’t done better in, say, Django.

Okay, how do I say this? Wikipedia is NOT the definitive source. While I admit that I wrote most of what’s in there, it is a NPOV, quick description of things. The definitive source is http://springpython.webfactional.com. I’m not trying to compete with Django or replace it. Again, Spring Python is NOT a web framework. I have written samples of how it can enhance your CherryPy app. I want to study the other python web frameworks, and see if Spring Python can help out.

Sure, but doesn’t everyone already have an ORM layer with a better description than “the SQL query and row-handling function”?

I have supported a particular application for several years, and it now has 200+ queries. I’m not about to migrate it to an ORM solution because I don’t have the time. I didn’t know that ORMs were the final answer to database access. It seems people are still debating the impedance mismatch between objects and relational databases. Sometimes, the technology-neutral language of SQL is the most portable, expressive way to communicate. Got an ORM? Do you enjoy using ORMs like SQLObject or SqlAlchemy? Great! Spring Python won’t get in your way. Frankly, I haven’t spotted ANYTHING where we can help them, either. But do you use pure SQL queries? We DO have something for you.

Reading from the database hasn’t required “a monotonous cycle of opening cursors”, etc. in a long time.

Again, if you are using an ORM, then Spring Python doesn’t have anything today. But if you are writing some pure SQL, you need to manage your cursors correctly. Have you read PEP-249 Python Database API Specification v2.0? The spec defines two method calls, one for connection objects and one for cursor objects: close. It clearly indicates that you can use this to close the connection before the object itself goes out of scope. If you are writing a tiny python app that exits after a bit, your connections and cursors will be garbage collected and these things will close automatically. But if you want to write any type of enterprise app that stays up ALL THE TIME, then you need to be correctly closing result sets.

I have worked on enterprise level Java apps, and one of the first pitfalls is failure to close cursors and connections when you are done. JdbcTemplate solves this problem for you. Python has the same issue to deal with, and DatabaseTemplate provides the same solution.

And I fully admit I’m being unfair. (Although having said that, XML config files are another thing I’m more than happy to drop.)

Thanks for being honest. I don’t mind someone putting in their $0.02. Regarding XML configuration files, I have two angles of approach: 1) make it easy for existing Java developers who have used Spring to migrate to Python and 2) support new Python users. The XML configuration option is to help support the Java developers. But I totally grasp the concept of avoiding XML situps. It’s why I rapidly wrote a pure python, decorator based IoC container after I had a working XML container. BTW, the key reason I started with XML was the fact that someone had already created one, and it helped me jump start things. Once again, in all tradition of Spring, the choice is yours.

XML may not be the most tasteful thing to pythonistas, but we still have to deal with it. For that, I gladly recommend Amara. We used it to rapidly rewrite our XML parsers. It works wonders.

I just ask that you visit our website, read our documentation, read the source code, and learn what this project is trying to accomplish before you make too many assumptions.

VN:F [1.8.4_1055]
Rating: 0.0/5 (0 votes cast)
VN:F [1.8.4_1055]
Rating: 0 (from 0 votes)

November 13, 2008

Spring Python uses Amara

Filed under: amara, releases — gregturn @ 8:42 am

Link: http://broadcast.oreilly.com/2008/11/spring-python-and-amara.html

For now, we are using Amara 1.2 because we need stable support. We definitely hope to migrate to 2.x someday, and we will have to deal with that python2.5+ requirement. This may require two versions of Spring Python. Supporting Python 2.4, 2.5, 2.6, 3+ all have impact on what we will support. There is always the pressure to upgrade, update, and get to the latest. But community support for older versions, especially big enterprises, has always been a strong point of Spring, so we won’t jump as quickly as some may want us to. Community needs will play a key role in this decision, and how many versions we support.

VN:F [1.8.4_1055]
Rating: 0.0/5 (0 votes cast)
VN:F [1.8.4_1055]
Rating: 0 (from 0 votes)

November 12, 2008

SpringSource has acquired G2One, the company behind Grails and Groovy.

Filed under: grails, news — gregturn @ 8:07 am

Link: http://blog.springsource.com/2008/11/11/more-weapons-for-the-war-on-complexity-springsource-acquires-groovygrails-leader/

I posted this in case you hadn’t heard, SpringSource has acquired the company behind Grails and Groovy.

You may wonder “what has this got to do with Python?” Well, I am always interested in tracking what SpringSource is up to, especially in the realm of dynamic languages. This is good news to me, because it shows SpringSource’s keen interest in this arena, which is also good for Python.

SpringSource acquired G2One

VN:F [1.8.4_1055]
Rating: 0.0/5 (0 votes cast)
VN:F [1.8.4_1055]
Rating: 0 (from 0 votes)

November 11, 2008

Spring Python 0.8.0 has been released

Filed under: news, releases — gregturn @ 10:51 am

This release contains a refactored IoC container supporting four formats (XMLConfig, PythonConfig/@Object, PyContainerConfig, and SpringJavaConfig); replacement of the term “component” with “object” in all APIs, classnames, etc.; and other bug fixes and API cleanup

VN:F [1.8.4_1055]
Rating: 0.0/5 (0 votes cast)
VN:F [1.8.4_1055]
Rating: 0 (from 0 votes)

Spring Python is cooking!

Filed under: aop, releases — gregturn @ 10:24 am

Spring Python is growing fast and I’m excited to be working on this project. I just wanted to list some of the things that shows the many ways this is happening.

First of all, I must point out that we just recently released version 0.8.0. This version contains the newly rewritten IoC container as well as changing from “component” to “object” in the classes and APIs. By separating object configuration from object creation, we have been able to write multiple parser including: the legacy PyContainer format, a new XML format custom built for Spring Python, Spring’s 2.5 XML format, and also a pure python @Object format. We can also reference between input sources with ease.

This release counts as the fourth one made since Spring Python became an official extension back in July. We have made at least one release per month, which if you check out JIRA, will see is current target pace leading up to version 1.0.0. A steady release cycle is a good sign of an active project.

I also have enjoyed answering questions posted in the community forum. I was really excited to be able to help a user who was experimenting with changes to ai4game, a pygame application. He wanted to wrap some objects with AOP. First of all, thanks to this user, we uncovered a bug in Spring Python, and I managed to code the patch immediately and get it out to this user. I like real-world examples because they show me what types of problems people are trying to solve and it also lets me know people are really using this software. It also helps expose bugs and grow the reliability of things.

Another things I’m really excited about is about this year’s Spring One Americas conference. Spring Python is scheduled for a presentation titled Introduction to Spring Python. Even if I’m talking to a relatively empty room, I will be excited to do that.

Also, seeing Russ getting out the word during his presentation at the London Spring Users Group was fantastic!

All of these things make me really glad to be working on Spring Python.

VN:F [1.8.4_1055]
Rating: 0.0/5 (0 votes cast)
VN:F [1.8.4_1055]
Rating: 0 (from 0 votes)