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.
0 Comments