IronPython 2.0 B5 - New Hosting API

For those interested in embedding IronPython in .NET applications there were two significant changes in IronPython 2 Beta 5. As this is the last beta before the release candidate, integrating this release should be the last changes you need to make.

The first change is that a significant portion of the hosting API has changed - and for some (but not all) use cases got a lot simpler.

Embedding Dynamic Language Runtime engines (what we are discussing here is the DLR hosting API) uses the App.Config file to configure the languages they intend to use. This part is probably more complicated than before. The DLR Hosting blog has a self-contained Visual Studio 2008 sample demonstrating how it works:
For languages like IronPython and IronRuby, convenience classes have been added that make hosting simpler. For IronPython the class is called Python. You can create a ScriptRuntime (one of the core hosting classes) without using the config system.

The DLR Hosting blog shows the basics:
Srivatsn (an IronPython tester) also has a blog on the subject - showing more of the convenience methods on the Python class. These include easy ScriptEngine creation and easy access to the builtin, sys and clr modules for an IronPython engine:
Srivatsn demonstrates pulling out builtin Python functions and calling them from C# - a useful technique for using dynamically created Python objects from other .NET languages.

Comments

Popular posts from this blog

Extending Abobe Flash Player and AIR with Python and Ruby

Should Python Projects Support IronPython and Jython?

Further Adventures of the Debugger