I read the SpringPython Book about a month ago, and liked it, so about two weeks ago, started building a small web application with it in an attempt to learn more about it. I have never used Python to build anything larger than a script, so this was a first for me. One reason I haven't even tried to do a Python webapp before is that we are a Java shop, and maintainability becomes an issue. In this instance, however, I think I have a use case which just feels more natural to solve with Python than with Java. .... As I have mentioned before, this is my very first Python webapp (although I have used Python for scripting (not that much recently), and I have used CherryPy before). It took me around 2 weeks to build this app, which is probably a bit long by the standards of a good Python programmer. I did have a couple of false starts - I wanted to use Apache ActiveMQ for the queueing, so I checked out first stompy and then ActiveMQ's REST interface with Universal Feed Parser before settling on the embedded database approach. But in any case I now have a working (production ready) Python app with a nice web interface, and I don't think I could have done it in this time using something other than SpringPython. SpringPython helped in two ways:
Go back to the article to see more details including chunks of code, configuration, where the author was able to revise and alter things to meet his needs, and final screen shots of this success story.
The Spring Framework carries a certain legacy that when carried into the Python world, can have strong negative consequences. There are blogs that discuss Should Python and XML Coexist?. Well, I have asked a similar question when I worked at a previous job while working with Java and XML. When I read Rod Johnson's blog entry about a pure Java Spring configuration option, I saw a code example that could become the beginnings of a beautiful relationship:
@Configuration
@Bean(scope = Scope.PROTOTYPE)
public Book book() {
Book book = new Book("Expert One-on-One J2EE Design and Development");
book.setAuthor(rod()); // rod() method is actually a bean reference !
return book;
}
}
Hey, I got the book! I have it and read it now, the security chapter is marvelous - it really helped me. Haven't tried the code as I'm reading it while commuting but I can already see it's going to be very useful.
The security chapter of the book goes into incredible detail about securing your python app using conventional means. And when that isn't enough, it also gives code samples on how to write your own code plugins.
You can see a nice Spring Python slideshow. It is based on the slide show I gave at the 2008 SpringOne conference. I updated some of the slides, included some info on where the book goes into more detail, and recorded an audio track. Share and enjoy!
Intro To Spring PythonView more webinars from gturnquist.
I was super excited to see this on my front porch went I got home today. I've already submitted a proposal to speak about Spring Python at the October SpringOne conference. Last time I did that was in December 2008. It was great meeting fellow Python enthusiasts. It would be even more exciting to meet more of you.
This book has been published! I got word this morning. This is fantastic news! I have been working for so long to get this out. I am happy that my readers can finally get a hold of this tome and start writing some Springy apps. Please visit my first entry written on SpringSource's blog site, which includes key links and information.
Spring Python takes the concepts of Spring and brings them to the world of Python. This includes features like dependency injection, aspect oriented programming, data access, transaction management, security, and remoting. All of these features when used in non-invasive, composable mechanisms, can help you build apps quicker while being able to maintain them over the long term. A big thank you goes out to the Spring Python developer team that has been supporting me throughout this time frame developing features and fixing bugs. I also thank my two independent technical reviewers: Russ Miles and Sylvain Hellegouarch. These two tech savvy guys really helped pull me from turning what was once an idea in my head into a readable book. The biggest appreciation is saved for my precious wife, who has given me unconditional support since Day 1 as well as my 11-month daughter. Their patience is incredible given the number of nights I have had to stay up late to write.
I thought you might like a peek at the chapters, so I captured this screenshot.
(UPDATE: One of my fans has already spotted the typo above where it says "Pyron" instead of "Pyro" as it should. I sent this in to my editor to fix it up. Thanks!)
I just finished reading the last pre-final section of the book. Things look pretty good. I have definitely sent them a stack of things to clean up. But overall, I feel good about . As soon as things get fixed and a-okayed, its off to the presses.
Spring Python never runs out of interesting things to work on. Most of the time, I'm working on new features and seeing how Python makes it so easy to implement what you are thinking. But at other times, I see criticism floating around the blogosphere. I know there is always going to be that, and as I said previously, I welcome criticism. It keeps you on your toes; makes you recheck your assumptions. But the kind of criticism that bugs me is when people make complaints without having read one piece of documentation, or expressed their opinions on our mailing list. I recently read a complaint about a missing feature of AOP. Well it caught me off guard that this person had opened a JIRA issue and then never bothered to mention it on our forum or on the mailing list. This was the first I really knew about it. I'll admit I don't monitor JIRA for new issues out of the blue. Instead, we usually coordinate either through IRC, the mailing list, or are driven by comments in the forum. An unassigned JIRA issue never reported is bound to escape my attention. Going on to read the issue, I couldn't make sense of what his code was doing. He was using Spring Python's AOP functionality in a way not documented, and then complaining that it didn't work like the docs said it would. Duh! Well, I had to check it out for myself, so I proceeded to walk through the docs, and it worked perfectly. I posted this chunk for everyone to see.Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import springpython >>> class SampleService: ... def method(self, data): ... return "You sent me %s" % data ... def doSomething(self): ... return "Okay, I'm doing something" ... >>> service = SampleService() >>> service.method("Hey") 'You sent me Hey' >>> service.doSomething() "Okay, I'm doing something" >>> from springpython.aop import * >>> class WrappingInterceptor(MethodInterceptor): ... def invoke(self, invocation): ... results = "<Wrapped>" + invocation.proceed() + "</Wrapped>" ... return results ... >>> factory = ProxyFactory() >>> factory.target = SampleService() >>> factory.interceptors.append(WrappingInterceptor()) >>> service = factory.getProxy() >>> print service.method("Hey") <Wrapped>You sent me Hey</Wrapped>
>>> It seems to work as advertised to me. I suppose that if you're going to open an issue on an open source project, it increases your odds of getting traction if you make SOME effort to communicate with the team, versus complaining on stack overflow.