On Sun, Apr 5, 2009 at 5:51 AM, Giovanni Giorgi <j...@objectsroot.com> wrote: > Hi all, I have just read the Thread "Thoughts on language-level > configuration support?" started by jfager. > I have worked in the past days with Java Spring. > I found very valuable the ideas behind Inversion of Control (IoC). > I think it should be a very nice feature to get into python too. > In detail, I think the most important concept is the ability to auto-wire > dependencies declared in the configuration file. > It is the "added value" of such idea in my own opinion. > Spring is heavily based on type declaration (in form of concrete class of > interfaces) so this approach is not the preferred path in a dynamically > language like Python. > Do someone have tried or seen something like IoC container based on Python? >
There are several projects implementing IoC in Python. The three I am most familiar with are snake-guice[0], pinsor[1] and SpringPython[2]. I think they are all worth investigating. I started snake-guice as a clone of the google-guice project (a Java IoC framework.) I liked several things that I just didn't see anywhere else: 1. Language based configuration because XML sucks 2. In code hints about what will be injected 3. Not a container - the injector injects and gets out of the way The documentation is a little lacking, but that will be changing in the next few days. Examples of using snake-guice with CherryPy, Django and TurboGears are just a few days off as well. The API tests[3] show simple clear examples. The project is going to be used on several very large websites. So you can expect it to be maintained for quite a while. I would encourage you to look at each project and leave feedback where you can. It can only help each project. 0. http://code.google.com/p/snake-guice/ 1. http://code.google.com/p/pinsor/ 2. http://springpython.webfactional.com/ 3. http://code.google.com/p/snake-guice/source/browse/trunk/snakeguice/tests/test_api_25.py -- David blog: http://www.traceback.org twitter: http://twitter.com/dstanek -- http://mail.python.org/mailman/listinfo/python-list