CodePlex will continue to be the tool we use for project management and releases, but all end-user information will be on IronPython.net. Also, the .com domain still points at the super-old site, but will redirect to this site shortly.
The most notably addition is the .NET Integration Documentation, a thorough set of examples and descriptions of using IronPython with .NET. Considering this is IronPython’s main purpose, it’s amazing we got away with having hardly no documentation for this long … I guess the .NET integration is just that intuitive :) Anyway, please give it a read and let us know if you have any suggestions.
Tuesday, December 15, 2009
IronPython gets a long overdue website!
Thanks to Jimmy Schementi (the new IronPython PM, Ruby lover and all round good guy) IronPython has a new website. And as said best on Reddit, it doesn't look like Microsoft made it. The site has links to documentation, community resources and online IronPython examples using Silverlight (including Try Python).
WCF Service in pure IronPython with config file
In previous blog entries Lukáš Čenovský looked into Databinding and WCF Services with IronPython 2.6. This uses the new __clrtype__ feature in IronPython 2.6 to interact with .NET features that previously couldn't be done with IronPython.
In this follow up blog entry Lukáš shows how to saved the IronPython interface in an assembly with a config file.
In this follow up blog entry Lukáš shows how to saved the IronPython interface in an assembly with a config file.
I was wrong when I wrote in the last post that the IronPython service cannot be saved into an assembly. It can. Which opens a way to use .config file to configure the service.
The interface is the same as in the previous version. The only difference in the service to the previous version is in the ServiceHost initialization - we omit the service configuration parameters because they are in the .config file. I also changed the clr namespace.
Labels:
web
Sunday, December 13, 2009
NWSGI 2 RC 2 and IronPython Extensions for Visual Studio 2010
Jeff Hardy is a big cheese in the IronPython world. One of his older projects is NWSGI, an implementation of the Python WSGI (Web Server Gateway Interface) specification for .NET. This allows Python WSGI applications to run on IronPython and be served by IIS.
One of his newer projects is an extension of Visual Studio 2010 (still in beta) to provide Python syntax highlighting and IronPython support.
Jeff has recently announced progress in both projects.
One of his newer projects is an extension of Visual Studio 2010 (still in beta) to provide Python syntax highlighting and IronPython support.
Jeff has recently announced progress in both projects.
The final release candidate of NWSGI 2.0 is now available. Except for version numbers, this is what will become NWSGI 2.0 as soon as IronPython 2.6 is released.
NWSGI 2.0 Release Candidate 2 includes all of the features of NWSGI 2.0 Release Candidate 1, and adds support configuring tracing, lightweight scopes, and the profiler. It is built against IronPython 2.6 RC3.
The following issues are fixed in this release:
- IronPython Extensions for Visual Studio 2010
- IronPython.VisualStudio on BitBucket
- IronPython.VisualStudio on the Visual Studio Gallery
Lately, I’ve been experimenting with the new editor APIs in Visual Studio 2010 to build some simple extensions to make Python editing a little better. Helpfully, IronPython exposes most of the complicated infrastructure (the tokenizer) to make the job easy. The documentation for the new editor APIs is still a bit weak; hopefully that will improve by the final release. In the meantime, the examples are the best source of information. There also a series of blog posts by an Mike Feingold about the NDjango editor for VS2010 that form a great end-to-end example.
Download & Installation
Download IronPython Extensions for Visual Studio 2010 (and the source code; Ms-PL as always) from my BitBucket repository or from the Visual Studio Gallery (direct link). For direct downloads, just run (double-click) the .vsix file to install it into Visual Studio. Otherwise, you can use the extension manager (search for "IronPython") and install it directly from Visual Studio.
Features
The extensions provide three features so far: syntax highlighting, brace matching, and outlining.
In the future I'm planning on adding project support, templates, and (most difficult of all) IntelliSense.
IronPython 2.6 Final Released
IronPython 2.6 is finally out! IronPython 2.6 is a new version of IronPython targeting compatibility with Python 2.6. As well as the new language and library features that come with Python 2.6, IronPython 2.6 has new features for improved performance, general Python compatibility and better .NET integration. It's a great release; congratulations and thanks to the IronPython team.
The full IronPython 2.6 release notes:
- Download IronPython 2.6
- IronPython Samples for IronPython 2.6
- Performance Comparison: IronPython 2.6 Final and CPython 2.6
- The __clrtype__ metaclass for data binding and .NET attribute support
- Implementation of the ctypes module
- Support for Python stack frames and sys.settrace, which means the pdb debugger works (and better debugging from the .NET side)
- Better performance through adaptive compilation
- Faster startup
CommentChecker
Not only will this sample show you how to utilize Word's spell checking functionality from IronPython; it'll also make your own Python code better! You see, this sample processes Python files looking for code comments that contain misspellings. Once these mistakes have been identified Word is utilized again to present you with the correct spellings. All of this is tied together with an elegant, user-friendly interface constructed from .NET's Windows Presentation Framework.
ClrTypePyc, the IronPython compiler, is no longer available as a sample as "it was incorporated directly into IronPython releases as a tool".
The ClrType sample shows how to define a class in IronPython with required CLR members. Normally, a class definition in Python does not map directly to a unique CLR type. This is because the semantics of classes are different between Python and the CLR. For example, in Python it is possible to change the base types just by assigning to the bases attribute on the type object. However, the same is not possible with CLR classes. Hence, IronPython implements Python classes without mapping them directly to CLR types. Using the ClrType sample you’ll be able to define CLR fields, properties, class-level attributes, and declare strongly-typed methods.
The full IronPython 2.6 release notes:
We’re proud to announce the release of IronPython 2.6 final. This is a major release with improvements across all areas of IronPython. Significant changes include:
Python 2.6 support includes a large number of new features which include support for the new bytes and byte array types (PEP 3112), decorators for classes (PEP 3129), advanced string formatting (PEP 3101) which will feel familiar to .NET users and integrates nicely with IFormattable, print as a function (PEP 3105), Abstract Base Classes (PEP 3119), support for binary literals, along with lots of other minor features and changes.
- Updating the language and standard library to match CPython 2.6
- Improved .NET integration
- Updating to the latest version of the DLR
- Adding previously missing CPython features and fixing bugs
- Performance improvements in particular startup time improvements
IronPython also continues to improve .NET integration in this release. We’ve added the __clrtype__ method to types which enables deep integration via meta-classes with the .NET type system. There are also a number of smaller changes such as supporting IDisposable in for loops matching the behavior of other .NET languages. This release also includes the latest version of the DLR and fixes a number of issues related to cross-language dynamic interop. Not to be left out there’s improvements in Silverlight integration by supporting Python code in HTML script tags.
We’ve also continued to improve Python compatibility by adding missing features and fixing bugs. In this release we’ve added support for the ctypes module which provides interop with native code in a compatible way across Python implementations. We’ve also implemented sys.settrace to provide support for the pdb module and other Python debuggers. This release also changes how we support sys.getframe: a fully working version is now available by a command line option; when not enabled sys.getframe doesn’t exist at all. This release also fixes over 400 bugs removing a large number of smaller incompatibilities.
As always we’ve also continued to improve performance, and this release primarily focuses on improving startup time. The IronPython installer now pre-compiles (ngens) IronPython during installation on both 32-bit and 64-bit platforms. Modules are now interpreted initially and hot functions are compiled for faster import times. A number of other code paths that used to involve runtime code generation have been optimized to be contained within the pre-compiled IronPython binaries. We’ve also made a number of smaller changes which improve performance in other areas such as adding constant folding.
Labels:
release
Tuesday, December 01, 2009
Gestalt 1.0 and the Gestalt Widget Pack
Gestalt is a project by Mix Online to use Silverlight and the Dynamic Language Runtime to allow you to script web pages with Python or Ruby instead of with Javascript.
tag to the top of your HTML file, you can automatically enable use of HTML5-compatible video and audio tag syntax."
DLR.js is a library released by a collaborative effort between the Dynamic Language Runtime team and MIX Online Labs. This JavaScript library allows you to write Ruby, Python & XAML code in your (X)HTML pages. It enables you to build richer and more powerful web applications by marrying the benefits of expressive languages, modern compilers, AJAX & RIAs with the write » save » refresh development model of the web.Gestalt has reached a significant milestone with the release of version 1.0 and a widget pack. It has matured to the point where you can do really crazy things like run Rails *in your browser*. Probably not specifically useful, but it shows what it is capable of:
A few months ago, we released Gestalt beta as a MIX Online lab. Gestalt began as an exploration—a way to bring Ruby and Python to the web browser. Today, we’re delighted to announce that Gestalt has been updated to version 1.0. It's now part of IronRuby 1.0 and IronPython.They also have a longer blog entry discussing the thinking behind Gestalt and what it makes possible. Perhaps worth drawing out from this article is the following: "By adding a <script>
What’s new in Gestalt 1.0? Gestalt Beta -- plus more!
- Supports bundling of Ruby and Python files using each language’s convention. You can now (for example) package and run Rails on your client!
- Allows you to dynamically load assemblies (only downloads what you need)
- Integrated with the Dynamic Language Runtime
Simplified and streamlined model for creating Gestalt apps.- No jQuery dependency.
- Support for remote references to Gestalt
- Visual Studio debugging support
- A browser console for debugging and manipulating Gestalt
- Rich error reporting
- Built-in support for loading external assemblies and content
- Support for running multiple instances of Gestalt on the same page
tag to the top of your HTML file, you can automatically enable use of HTML5-compatible video and audio tag syntax."
Last week, we discussed the fact that Microsoft invests heavily in both HTML5 and Silverlight, two technologies that other companies would have you believe are mortally opposed. Our commitment to both was underscored this week by our announcements about IE9 and Silverlight 4.
When we launched Gestalt beta less than 4 months ago, our goal was to demonstrate a really simple idea: that a proprietary plugin like Silverlight complements and advances the standards-based web. With today’s launch of Gestalt 1.0 and the first few widgets in the Gestalt Widgets Pack, I’d like to drill deeper into this underlying philosophy of Gestalt.
Labels:
project,
release,
silverlight
Tuesday, November 24, 2009
Cheminformatics Tutorial Using Python and Silverlight
Try Python is an online interactive Python tutorial using IronPython and Silverlight. The source code is available and open source and the tutorial material is written in a subset of the ReStructured Text markup.
Noel Baoilleach has taken this a step further by creating his own version, including the Webel library library and a tutorial on using it with interactive examples.
Noel Baoilleach has taken this a step further by creating his own version, including the Webel library library and a tutorial on using it with interactive examples.
Recently I introduced Webel, a Python cheminformatics module that runs entirely on web services. One of the advantages of such a module is that it can be used in places where it is difficult to install a traditional cheminformatics toolkit. Like in your browser.Personally I think the Cheminformatics version of Try Python would be improved by the removal of the Python tutorial parts (only part 6 is Cheminformatics specific - making it a bit harder to find!). Creating custom tutorials using Try Python as a base is *fairly* easy (I'm sure it could be easier): it could be a great way of creating online examples of working with .NET or Python libraries.... I hope more people try this out.
After some little work, I present Try Python...with Cheminformatics. This adds Webel as well as a short tutorial that introduces many of its features. With a few more tutorials that cover SMILES, InChI and so on in more detail, this could be useful for teaching purposes as well as bridging the gap to having students develop their own Python scripts that use the CDK, OpenBabel or the RDKit.
Labels:
silverlight,
tutorial
Sunday, November 22, 2009
Hello GTK# from IronPython and F#
GTK# is a managed interface to the GTK user interface library. GTK# is part of the Mono project, but it can also be used from .NET on Windows.
In this blog entry, another one from Steve Gilham, he illustrates using GTK# from both IronPython and C# by porting some C# examples.
In this blog entry, another one from Steve Gilham, he illustrates using GTK# from both IronPython and C# by porting some C# examples.
A little post to record a short bit of spiking with GTK# as UI toolkit, porting the simple C# examples from here to my preferred .net languages. Neither of these explorations are totally novel -- there are examples in either language to Google, but not all of them recorded all the details of the slight rough spots that needed a little working (and they were often not at all recent, either).
For IronPython 2.6 latest with GTK# 2.12.9-2, running the programs as ipy Program.py.
The dynamic nature of the language means we can lose a lot of the declaration clutter. We just have to explicitly reference the main GTK# assembly (which is GAC'd by the GTK# installer), and away we go.
A Good Mix 32: Alpha Encoding Files, Embedding IronPython in Russian, IronSharePoint, IronRuby, World's Worst Paint Program
More IronPython and DLR related projects, articles and news from around the web.
Steve Gilham shows how to generated encoded version strings for installers using IronPython:
A while ago Christian Glessner announced the start of the IronSharePoint project: showing how to develop SharePoint applications with IronPython. Well, he hasn't released anything but there is now code available for download from the Codeplex site. Could be worth exploring if you work with SharePoint...
Since early 2007 John Lam has been working for Microsoft as program manager of IronRuby, the implementation of Ruby on the Dynamic Language Runtime. Up until almost eleven months ago that is. John quietly transferred to a 'secret' project within Microsoft, a project that has also claimed Curt Hagenlocher (IronCurt). As they are *close* to being able to announce the secret project John has made his departure from the IronRuby team official and handed over the reigns to Jimmy Schementi who was previously only in charge of the integration between dynamic languages and Silverlight. Now Jimmy is doing both.
Dino Veihland presented on IronPython and the Dynamic Language Runtime at the recent PDC conference. Part of his talk featured the "World's Worst Paint Program", which from Dino's description includes both IronPython and IronRuby code. He has made this available for download from the IronPython Codeplex Site.
Steve Gilham shows how to generated encoded version strings for installers using IronPython:
When building installers the UpgradeVersion must have a unique property value that is an installer public property (upper-case alpha). So, what better way of adding uniqueness than making it have the form "product name + product version" with the version suitably encoded...An article on IronPython, and in particular using IronPython from C#, in Russian.
So, a script for turning a file version (4 x 16bit ints) encoded as a System.Version into a short alpha string, assuming that Major and Minor will be small, and that common approaches are to step Build, to use a stepped Build plus date-stamped Revision, or a timestamp Build and Revision.
A while ago Christian Glessner announced the start of the IronSharePoint project: showing how to develop SharePoint applications with IronPython. Well, he hasn't released anything but there is now code available for download from the Codeplex site. Could be worth exploring if you work with SharePoint...
Since early 2007 John Lam has been working for Microsoft as program manager of IronRuby, the implementation of Ruby on the Dynamic Language Runtime. Up until almost eleven months ago that is. John quietly transferred to a 'secret' project within Microsoft, a project that has also claimed Curt Hagenlocher (IronCurt). As they are *close* to being able to announce the secret project John has made his departure from the IronRuby team official and handed over the reigns to Jimmy Schementi who was previously only in charge of the integration between dynamic languages and Silverlight. Now Jimmy is doing both.
Dino Veihland presented on IronPython and the Dynamic Language Runtime at the recent PDC conference. Part of his talk featured the "World's Worst Paint Program", which from Dino's description includes both IronPython and IronRuby code. He has made this available for download from the IronPython Codeplex Site.
This is built using Visual Studio 2010 Beta 2 and the IronPython CTP for that release - so you'll need to download both of those. I've also included the Python and Ruby code that I used during the demonstration in a file called code.txt. The paint program it's self is in the final form at the end of the demo.
Saturday, November 21, 2009
Face Detection with IronPython
Face detection in images is very cool (and perhaps a little bit scary), and with the help of Emgu CV it can be done from IronPython.
Emgu CV is a cross platform .Net wrapper to the Intel OpenCV image processing library. Allowing OpenCV functions to be called from .NET compatible languages such as C#, VB, VC++, IronPython etc. The wrapper can be compiled in Mono and run on Linux / Mac OS X.This blog entry from Clark Updike shows how.
A couple notes compared to the Emgu wiki version--I was able to get everything working without having to disturb the IronPython install (I didn't copy any files into the IronPython start directory). I simply linked used sys.path to add the locations where the dll's live. Also, I did explicit import for everything. It's a bit more work to figure out what needs to be imported, but it avoids namespace pollution issues. Also, the img.Draw line needed a few tweaks. I had to drop the [float] bit from the original. And with the original version, I was also getting an error on this same line, saying:
TypeError: expected MCvBox2D, got MCvAvgComp
I was able to work around this by passing in the ".rect" rectangle attribute to the Draw method (I'm guessing the api has evolved since the 1.4 Emgu version used for the original). Lastly, I was getting to objects detected--so I used parameters to the detector to only get the single face in the image (basically by telling it to use a larger minimum detection size, minSearchScale). Anyway, now it works the way I was hoping.
Labels:
snippet
Databinding and WCF Services with IronPython 2.6
One of the important new features in IronPython 2.6 is the __clrtype__ metaclass.The __clrtype__ metaclass allows you to create a real .NET class that backs your Python classes. This is important because there are many .NET features that *require* a real .NET class: which includes databinding and implementing WCF services (Windows Communication Foundation).
The problem with __clrtype__ is that it requires dealing with low level details; namely building the class yourself from IL bytecode. Harry Pierson and Shri Borde have been working on a library (clrtype.py) to make this simpler.
Lukáš Čenovský has looked at this before but hit limitations with what clrtype made possible. In three new blog entries he demonstrates how to use __clrtype__ with databinding in WPF and Silverlight and to implement WCF services.
Even using __clrtype__ you still couldn't use WCF (for creating and consuming web services) from pure IronPython because it requires *creating* interfaces, which couldn't be done. With the latest improvements to clrtype it is now possible.
The problem with __clrtype__ is that it requires dealing with low level details; namely building the class yourself from IL bytecode. Harry Pierson and Shri Borde have been working on a library (clrtype.py) to make this simpler.
Lukáš Čenovský has looked at this before but hit limitations with what clrtype made possible. In three new blog entries he demonstrates how to use __clrtype__ with databinding in WPF and Silverlight and to implement WCF services.
INotifyPropertyChanged is important interface for building WPF or Silverlight applications using M-V-VM concept (MSDN article).This article uses the updated clrtype module to apply the databinding technique to Silverlight. The cool thing is that I'm already using this technique for databinding with the Silverlight Toolkit DataGrid in my new job. No more stub C# proxy classes, yay!
In simple language, you have a Model which provides access to your data (e.g in database, files, web, etc.). Then you have a ViewModel that access data in the Model via Model's interface and provides data to a View which is XAML file with UI layout. Linkage between ViewModel and View is done by binding that utilizes PropertyChanged event to properly update all UI elements.
I have found two examples how to implement INotifyPropertyChanged interface in IronPython. The first one uses __setattr__ hook. Personally, I don't like it - it is not clear and easily readable code. The second one is better because it uses properties. But you have to write self.OnPropertyChanged("my_property_name") for every property. Not ideal.
That's why I sit down and write a notify_property.
Even using __clrtype__ you still couldn't use WCF (for creating and consuming web services) from pure IronPython because it requires *creating* interfaces, which couldn't be done. With the latest improvements to clrtype it is now possible.
I wrote about implementing WCF service in IronPython a couple of weeks ago. Meanwhile I pushed Shri a little bit with the clrtype.py and he has implemented ClrInterface metaclass there so we can create the whole WCF service in IronPython now.
The IronPython interface implementation is straightforward.
Also switching from C# interface to IronPython interface is easy.
Labels:
article,
silverlight,
web,
wpf
Friday, November 20, 2009
IronPython 2.6 Release Candidate 3
IronPython 2.6 is the up-and-coming version of IronPython targeting compatibility with Python 2.6. As well as the new features in Python 2.6, IronPython 2.6 has several important new features specific to IronPython. These include:
- The __clrtype__ metaclass for data binding and .NET attribute support
- Implementation of the ctypes module
- Support for Python stack frames and sys.settrace, which means the pdb debugger works
- Better performance through adaptive compilation
- Faster startup
We’re pleased to announce the third and hopefully final release candidate of IronPython 2.6. Release Candidate 3 only includes Silverlight-related changes pertaining to some incompatibilities between 2.6 RC1 and RC2. Those who utilize IronPython for non-Silverlight scenarios will happily find virtually no churn from RC2. We strongly encourage everyone interested in Silverlight to test out this release ASAP because we plan on releasing IronPython 2.6 final in a week if no major new regressions are detected.
Labels:
release
Two Articles: IronPython 2.0 and WPF Error
Two more articles from Ibrahim Kivanc, the Turkish blogger who has written several articles on IronPython and Silverlight. Both of these articles are in English.
If you insist on trying out IronPython Studio there are various minor trials and tribulations for you to overcome; using the WPF designer is one of them. In this article Ibrahim explains how to jump over this particular hurdle and get the WPF designer working in IronPython Studio.
IronPython 2.0 version now runs on DLR (Dynamic Language Runtime). DLR is a platform on .NET which is host Dynamicly typed languages on it. Now Dynamic Languages Communicate eachother and C#,VB, COM Objects, .NET Libraries.In my opinion IronPython Studio is not stable enough for production use. It does have the advantage of being integrated in Visual Studio so some people can't resist trying it out. (You can read my write-up of IronPython Studio at: IronPython Tools and IDEs.)
IronPython, with 2.0 version runs on DLR (Dynamic Language Runtime); it’s a platform like CLR architecture. It’s host for Dynamic Languages on .NET. With this architecture Dynamic Languages now faster then running on CLR and easily communicate with other .NET objects!
If you insist on trying out IronPython Studio there are various minor trials and tribulations for you to overcome; using the WPF designer is one of them. In this article Ibrahim explains how to jump over this particular hurdle and get the WPF designer working in IronPython Studio.
Labels:
article,
ide,
visual studio,
wpf
Subscribe to:
Posts (Atom)