"Spring Python is an offshoot of the Java-based Spring Framework and Spring Security, targeted for Python. Spring provides many useful features, and I wanted those same features available when working with Python." -- Greg Turnquist, project lead

Home

Another success story with Spring Python

Spring Python book - Mon, 08/30/2010 - 11:27

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:

  • Coily provided a working archetype - this helped immensely. Building a webapp involves many components, and having to only work on the application can be a huge time (and effort) saver.
  • Dependency Injection - Since I was familiar with Java Spring, using SpringPython's DatabaseTemplate and @transactional annotations, and even the concepts of ApplicationContext, etc, felt very familiar and intuitive to use.
via sujitpal.blogspot.com

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.

Permalink | Leave a comment  »

Spring isn't just a bunch of XML

Spring Python book - Mon, 07/12/2010 - 11:35

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
public class MyConfig {
   @Bean
   public Person rod() {
      return new Person("Rod Johnson");
   }

 

   @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;
   }
}


To me, it seemed simpler to read configuration of code written in the same language as the code itself. When Spring Java Config made its debut, I migrated an existing application over to it immediately. It should be no surprise that when I started Spring Python, this was one of the target features I pursued.   When I decided to write the book, it was a no-brainer that I would code all the sample configurations using pure Python. The only areas where it made sense to write about XML was where I wanted to offer that convenient bridge for Java developers to transisition some/all of their code into Python. I have done plenty of upgrades/transitions/rewrites and I have found that the less it takes to move into a new area of technology, the better my chances of success are. Being able to migrate one bit at a time makes it possible to transition smoothly while still adding new features. That is the message I wanted to convey.   I was really happy to read a 5-star book review this morning where one of my readers caught this perfectly.

...I can only applaud that despite its Java roots almost no XML is used - that's a good news for all Python programmers fearing that "Spring" means a lot of unnecessary XML, the prevailing majority of examples is in pure Python.   Spring Python doesn't mean a lot of XML. Code it with pure Python and enjoy!

Permalink | Leave a comment  »

Security doesn't have to be hard

Spring Python book - Wed, 06/09/2010 - 19:12

  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.  

Permalink | Leave a comment  »

Slide cast about Spring Python mentions book

Spring Python book - Wed, 06/02/2010 - 17:53

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.

Permalink | Leave a comment  »

It's here!

Spring Python book - Thu, 05/27/2010 - 19:08

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.

Permalink | Leave a comment  »

Spring Python 1.1 book is published!

Spring Python book - Mon, 05/24/2010 - 12:22

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.

Permalink | Leave a comment  »

Communication is key

Spring Python book - Fri, 05/14/2010 - 16:20

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.

Permalink | Leave a comment  »

Spring Python 1.1.0 released

Spring Python blog - Tue, 05/11/2010 - 10:35
The final release of Spring Python 1.1.0 is out. Spring Python takes the concepts of Spring and applies them to the Python. This includes functionality like dependency injection, aspect oriented programming, data access, transaction management, security, remoting, and even python-to-java-to-python communication through JMS. Spring Python has been growing since 2006 and was the first Spring Extension [...]

There is no better time write than now

Spring Python blog - Fri, 04/23/2010 - 16:12
I just handed our keys and garage door opener to the title company. Doing this while writing a book highlights how easy it is in this day and Internet age to really work from a laptop. As stressful as these last couple of days have been, I’m glad I decided to write. If you [...]

Spring Python 1.1.0.RC1 released

Spring Python blog - Wed, 04/07/2010 - 12:17
See http://www.springsource.org/node/2490 for the official notice. Spring Python takes the concepts of the Spring Framework and applies them to Python. This includes features like dependency injection, aop, remoting, data access, transactions, and security, all with a non-invasiveness style. This is the first release candidate for version 1.1. We are quickly approaching final release. You can read more detail with [...]

Spring Python 1.1.0.M2 is released

Spring Python blog - Fri, 04/02/2010 - 10:51
See http://www.springsource.org/node/2489 for the official notice. Spring Python takes the concepts of the Spring Framework and applies them to Python. This includes features like dependency injection, aop, remoting, data access, transactions, and security, all with a non-invasiveness style. This is the last planned milestone for version 1.1. We are quickly approaching final release. You can read more [...]
Syndicate content