Sunday, April 25, 2010

IronPython in PyCharm, a new Python IDE

PyCharm is a new Python IDE from the JetBrains team, still available only as an "early preview" (beta planned this summer). As well as the "usual features" for Python IDEs (debugger, syntax highlighting, projects and code navigation, code completion, testing and version control integration, etc) it has some nice features like django support, Python refactoring and support for IronPython.

Some of the details of the IronPython support are on the PyCharm blog:

IronPython support. It includes the possibility to generate Python stubs for .NET assemblies, but for performance reasons the generation isn’t performed on project opening and needs to be triggered manually (press Alt-Enter on an import statement).


This will allow for code-completion (intellisense) to work for IronPython code in the PyCharm IDE. 

A Good Mix 35: Visual Studio, WPF, a cross-platform Resolver One and IronJS (A DLR based Javascript)

Another collection of IronPython and DLR related articles from recent weeks.


This extension adds IronPython and IronRuby to PowerConsole  so that you can interact with Visual Studio in IronPython/IronRuby. Please be aware that this extension only provides a simple tool to explore and interact with VS itself. It does not aim to be a development experience for the included languages.

An IronPython GUI library compatible with the Python GUI library EasyGUI. As the name implies, it is built on the WPF GUI library (making it Windows only). Like EasyGUI it has a demo app when you run the file showing the different controls/widgets the library supports.


For more examples of how to use it visit the EasyGUI tutorial.

Resolver One is a programmable spreadsheet written in IronPython. As well as being extremely powerful Resolver One is the largest codebase of IronPython "in the wild". Unfortunately because of third party .NET components used for the user interface Resolver One runs on Windows only.

The third party grid imposes other limitations on Resolver One, so the development team have finally decided to replace it with a custom grid that they are writing from scratch in IronPython. As well as giving them more flexibility, this is the first step towards making Resolver One cross platform (through Mono). The screencast linked above show you their progress so far, you can also read a bit more about their adventures in this blog entry on text rendering with GDI and GDI+.
IronJS is an implementation of Javascript for the Dynamic Language Runtime. By being built on top of the DLR it should be possible for code and objects written in IronPython, IronRuby and IronJS to interoperate. IronJS is not written by Microsoft, but instead is the creation of Fredrik Holmström.

IronJS is not complete, but is not far off. For example it recently became capable of compiling jQuery. Performance is also pretty good:
All in all I’ve reached my performance goal with IronJS, now it’s time to finish the runtime to support all statements/expressions/built-ins from the ECMAScript 3 Spec, there will still be changes which affect the performance of the core runtime/compiler, but (hopefully) not by any large amounts

Sunday, April 18, 2010

IronPython y SharpDevelop, en español (IronPython and SharpDevelop in Spanish)

A guide to using IronPython with the SharpDevelop IDE translated into Spanish. SharpDevelop is a .NET IDE for Windows. Of all the major .NET IDEs it has the best support for IronPython.

Hola. En este post vamos a hablar un poco del hermano de Python (ó CPython) para la plataforma de desarrollo de Microsoft .NET, IronPython.
Como he comentado a lo largo de la vida de este blog, alguien que se quiera dedicar a esta bendita profesión no puede estar ajeno a las combulsiones que se originan en este mundo. Si alguien no se había enterado (que creo que no) Microsoft ha lanzado una nueva versión de su archiconocido Visual Studio, versión 2010, junto con la plataforma de desarrollo Framework .NET 4.0. Según parece en esta versión se le empieza a dar una mayor importancia a lenguajes dinámicos, como IronPython. Y es por ello que me he decicido a investigar este territorio, tan inóspito para mí. Y es que aprender nunca pasa de moda.
Decir que IronPython es un lenguaje creado por Microsoft, aunque no hay que pagar ningún tipo de licencia. IronPython es una implementación de CPython (ó Python) escrita en C#.
También he leído (que no probado) que IronPython funciona con la plataforma Mono.
IronPython está ligado a la plataforma .NET en la cual nos encontremos, dándole soporte en su versión 2, y ahora con más fuerza en la versión 4. No es objetivo de este post describir la historia ni características de IronPython en profundidad (¡para eso he puesto los links!)

Tuesday, April 13, 2010

IronPython 2.6.1 Released

There have been three "IronPython relevant" releases in the last twenty four hours with another one to come.
  • IronPython 2.6.1 (for .NET 2 and .NET 4)
  • .NET 4.0
  • Visual Studio 2010
The next release is Silverlight 4, which includes new features like out-of-browser support, new controls (a rich text editor component), web cam and printing support and lots more. For those who still aren't aware, Silverlight is a browser plugin that works with Windows and Mac OS X and in IE, Safari, Firefox and Chrome browsers. There is an official port from the Mono team, called Moonlight, that works with Linux and Firefox.

.NET 4.0 is the version of the .NET framework (and C# language) that includes support for the dynamic keyword - allowing for dynamic typing in C# and easier interoperation between C# and dynamic languages.

IronPython 2.6.1 is the latest stable release of IronPython. Despite being a minor point release there are some very nice improvements and new features. Headline features include faster importing and startup, bugfixes in ctypes, *much* better Python Unicode compatibility and ssl module compatibility:
We’re pleased to announce the final release of IronPython 2.6.1. This version of IronPython makes great strides in stability and compatibility, including a considerable number of targeted bugfixes. This is our largest servicing release to date, and with your help both before and during the RC phase, along with the simultaneous release of .NET 4.0, this has become a very exciting release for all of us.

The IronPython 2.6.1 RC included fixes for well over 50 bugs, large and small. Ctypes has had a number of significant updates, including union support, variant_bool, and wintypes. Another focus has been on sys.settrace, making debugging more reliable. For example, sys.settrace now returns the correct frame, supports tracing through modules, and no longer interferes with “import os”. Other notable fixes include thread-safe importing, and the missing error code in _winreg exception.

In addition, we’ve made a substantial improvement in import time. Not only does this reduce startup time, but it can speed up the importing of large, definition-heavy modules by up to 50%.

Since the RC, we have fixed numerous other issues, as well as adding CPython’s ssl.py to our distribution. We’ve also made some major unicode-related changes in response to your feedback on the mailing list, changes that improve compatibility with certain third-party applications including Django. In particular, invoking unicode() or using unicode string formatting will now call __unicode__() first if it is present on the object. Finally, we’ve included a new code sample that shows how to use __clrtype__ to create custom CLR classes from IronPython. This sample is a sneak preview of what we expect will become a fully supported IronPython module, so we encourage anyone who is so inclined to try it out and let us know how it goes.
.NET 4.0 includes a new version of the Common Language Runtime and to use the new features you need to use a version of IronPython compiled against .NET 4. This is why IronPython for .NET 4 is a separate download. Surprisingly, this version of IronPython is much faster than IronPython for .NET 2. Dave Fugate blogs about this (and other improvements for working with IronPython under .NET 4):
Where exactly is this improvement coming from?  Well we don't know quite yet.  Our first bona fide .NET 2.0 SP1 versus .NET 4.0 IronPython perf suite run occurred less than two weeks ago!  An educated guess is that at least a small portion of this improvement stems from the fact that Microsoft.Scripting.Core.dll is actually part of the .NET 4.0 framework.  Any ways, you can see more of the performance characteristics of IronPython running under both these .NET releases here.

Monday, April 05, 2010

Professional IronPython

Professional IronPython is a new book on IronPython, published by Wrox and written by John Meuller (who has apparently written 73 books).


Create applications that are more responsive to user needs

IronPython should be an important part of your developer's toolbox and this book will quickly get you up and running with this powerful language. John Paul Mueller clearly shows how IronPython can help you create better desktop or web-based applications in less time and with fewer errors. Throughout the pages, you'll find techniques for extending IronPython and making it a more robust language. In addition, you'll follow advanced steps such as building an IronPython extension that directly accesses the Win32 API. And you'll enhance your skill set as you introduce IronPython into other environments such as Linux® and Mac OS® X.      

Professional IronPython is the third book on IronPython, with the first two being IronPython in Action and Pro IronPython. It will come as no surprise to hear that my personal recommendation is IronPython in Action...