Posts

Showing posts with the label article

Acceptance Testing .NET Applications using IronPython

This article, written by Jonathan Hartley, was originally published in the Python Magazine. Acceptance Testing .NET Applications using IronPython Unit tests demonstrate to developers that individual functions and classes work as expected. Acceptance tests are an orthogonal complement to this. They verify to everybody, including managers and clients, that features they understand and care about are completed and working correctly. They also prove that the system as a whole is correctly integrated and that no regressions have occurred. Resolver Systems is developing a .NET desktop spreadsheet application, Resolver One, for which we have accumulated an acceptance testing framework. This framework uses Python’s standard unittest module, and is executed using IronPython. While Resolver One is written in IronPython, this technique allows IronPython tests to interact with product code written in any .NET language. This article describes the principles of this IronPython acceptance test...

Why IronPython Podcast and Best of MSDN Ebook

I recently wrote an article for the UK MSDN (Microsoft Developer Network) newsletter called Why IronPython? This article made it into the collection of the thirteen best technical articles of 2009: You can download these articles as a free ebook in XPS or PDF format, or read it online: FREE MSDN Flash eBook of the best 13 technical articles of 2009 The UK MSDN Flash developer newsletter contains great short technical articles written by UK developers both inside Microsoft and in the broader developer community. This eBook pulls together these great articles in one place. There are thirteen articles in this second edition covering Python, Inversion of Control, Behavior Driven Development, Silverlight and more. The MSDN Flash newsletter is run by Eric Nelson. He also has a podcast and we recorded an episode together about Python, IronPython, PyCon and various other topics: MSDN Flash Podcast 018 – Michael Foord discusses IronPython A great chat with Michael Foord, author of IronP...

Why IronPython?

This is a short article I wrote for the UK MSDN Flash newsletter (a Microsoft newsletter for developers). Unfortunately the online versions of these newsletters aren't being updated at the moment; so instead of linking to it I'm reproducing it here. Why IronPython? One of the new features in .NET 4.0 is the dynamic keyword, building on the Dynamic Language Runtime. A major reason for dynamic is to enable easier interaction with dynamic languages like IronPython. But if you're a dyed in the wool C# or VB.NET programmer why should you be interested in IronPython? Much of the discussion here applies to other dynamic languages, including IronRuby, but Python is my particular area of expertise. IronPython is a .NET implementation of the popular open source programming language Python. Python is an expressive language that is easy to learn and supports several different programming styles; interactive, scripting, procedural, functional...

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. INotifyPropertyChanged and databinding in IronPython WPF   INotifyPropertyChanged is important interface for building WPF or Silverlight applications using M-V-...

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. IronPython 2.0 and Access to .NET Libraries 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. 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!   IronPython WPF Error 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 .) If y...

Using Solver Foundation and plug-in solvers in IronPython

Microsoft Solver Foundation is a set of mathematical programming tools that can be used from .NET languages like C#, F# and IronPython: Solver Foundation Services (SFS) can automatically analyze models and determine which solver is most appropriate. If you are an advanced modeler, you can choose specific solvers and solver attributes. While solving the models, SFS manages all threading, many-core, synchronization, scheduling, and model execution issues. When finished, SFS produces reports about solver behavior and results, and provides additional information about solutions, including sensitivity. Finally, SFS allows LINQ data binding of model parameters and delivery of results in multiple formats. Lengning Liu has a blog entry on using the solver foundation from IronPython, including the magic incantations in app.config required to use plug in solvers. Using Solver Foundation and plug-in solvers in IronPython Solver Foundation provides an easy-to-use and flexible plug-in infras...

Talking to ActiveDirectory from (Iron)Python

Active directory is one of the standard (and important) parts of a Windows network. Working with active directory is therefore a common task for a Windows system administrator. Naturally you can work with active directory from Python , but there is also good support for active directory in the .NET framework that can be accessed from IronPython (including from IronPython on Mono). This is something that Brendan McAdams has been exploring on the Evil Monkey Labs blog and has created a utility module to make it even easier: Talking to ActiveDirectory from (Iron)Python ad_util.py on github  We're building a new intranet system at work, and I've been toying with a few things that the Windows admin asked for. Namely, since the secretaries here will update the intranet data to add people's Work & Emergency contact numbers, AIM handles, email addresses, etc. that we find a way to keep it all in sync with ActiveDirectory. Thereby keeping all the Outlooks and Blackberries up ...

A Good Mix 28: NTornado, WPF, Testing in Italian, More Benchmarking, and adodbapi

Yet another collection of IronPython and DLR related articles, projects and blog entries from the past few weeks. NTornado NTornado is an IronPython version of the Tornando web server. The Tornado Web Server is the open source version of the non-blocking web server that power FriendFeed and now part of the Facebook's open source initiative. This server is coded in Python and with strong emphasis on operating systems with epoll support. NTornado is a port of Tornado to IronPython using asynchronous high-performance sockets in .NET. To run the demos (requires IronPython 2.6): > ipy -X:Frames "demo file name".py Getting WPF Control Template in IronPython I always find myself needing a control template so I can customize one of the WPF controls. I used to fire up Expression Blend to get it, and then realized I could write a little IronPython code to do it. Paste this code into the IronPython 2.0 or 2.6 console to see it work! Modulo .NET test con IronPython  A tr...

Articles by Ibrahim: IronPython Console, ASP.NET, Visual Studio and readmee.com

Ibrahim is the Turkish blogger whose posts and articles on IronPython that we've featured before . He has published several more articles in English on working with IronPython and one article in Turkish. IronPython Console  In this article we take a deep look at IronPython Interactive Console. We will see some basics of Python and IronPython to become acquainted with the IronPython environment. IronPython interactive interpreter console is the easiest way to start using IronPython.  We can easily explore whole IronPython world which is include ironpython modules, .Net libraries and Python Built-in’s. For IronPython starters it’s great way to exploring .Net Libraries. We can use IronPython Interactive Interpreter for start to developing WinForms, COM objects, WPF, XNA, Embeding C#, Silverlight… projects. Asp.NET with IronPython Integration One of the IronPython development area is Asp.NET. In this article we will see Visual Studio 2008 Asp.Net integration. First check ou...

Introduction to IronPython, Python for .NET Programmers and Dark Corners of IronPython

I've written three new articles on IronPython and put them up on my website . The first two are for developers new to Python or to IronPython whilst the third will be useful to anyone developing with IronPython whatever their programming background. Introduction to IronPython and the DLR   Just getting started with IronPython or wondering why you should be interested? This article introduces IronPython, explains how it came into existence and some of its more common use cases. The article also shows the basic IronPython and .NET integration with the interactive interpreter. The IronPython interactive interpreter is a great way to learn plus a useful tool for working with the .NET framework. The article even shows how the Dynamic Language Runtime allows languages to interoperate by using a Ruby library (through IronRuby) from IronPython. Python for .NET Programmers An introduction to the Python programming language for programmers interested in IronPython. It covers the basic sy...

IronPython articles in English and Videos in Turkish

Ibrahim Kivanc is a Turkish blogger and programmer whose articles on Silverlight we have covered previously . He has now translated some of his articles on IronPython into English for us poor foreigners and created some screencasts in Turkish. IronPython: Dynamic Languages  As you know programming languages classified in two way; Dynamic Languages and Static Languages. In some cases Dynamic Languages has many advantages rather then Static Languages. Python/IronPython and Ruby are Dynamic Languages; C#,Visual Basic are Static Languages. Dynamic Languages that execute at runtime many common behaviors that other languages might perform during complication, if at all. These behaviors could include extension of the program, by adding new code, by extending objects and definitions, or by modifying the type system, all during program execution. These behaviors can be emulated in nearly any language of sufficient complexity, but dynamic languages provide direct tools to make use of...

Darrell Hawley on IronPython and LINQ

Darrell Hawley is a Microsoft MVP with an interest in IronPython. We've featured some of his previous writings here , here and here . He's made a couple of posts on using LINQ from IronPython. LINQ is a .NET feature that give first class syntax in C# to queries. Under the hood LINQ is implemented as a series of extension methods and classes. In it's basic form LINQ is similar to Python generator expressions . As well as working on objects LINQ expressions can be used to generate SQL queries. A Python equivalent would be the Dejavu project . LINQ is a language feature where multi-line lambdas really show their power; something that isn't possible in Python of course where lambda functions are restricted to a single expression. The power of LINQ causes Darrell to describe it as: Python developers would be better served to think of LINQ as wrappers around the map , filter and reduce functions. In fact, LINQ is not much different than the “recipes” found in the offi...

Using IronPython to Configure Castle Windsor

This is part 3 of a series of articles, by Moukarram Kabbash, on configuring the Castle Windsor Inversion of Control container for .NET with IronPython. We previously covered the first two articles in the series. Using IronPython to configure Castle Windsor III In the first two articles I introduced Pysor, the Castle Windsor configuration tool using IronPython. Now I have added some exciting functions to exploit the nice hash table and list syntax feature in IronPython. Since the second part of this series is possible to add (named) parameters to component registration. It accepted only both literal and referential scalars. In the current revision you can exploit the nice list syntax of Python using the square brackets to add arrays and list parameters. The configuration project is called Pysor and is available for download from Github: Pysor: A tool to configure Castle Windsor using IronPython   The updated to-do list is now Adding a nicer API for referencing assemblies ...

IronPython Tools and IDEs (and important news about PyDev)

A frequent question on the IronPython mailing list is "what IDE should I use with IronPython?". For many .NET developers the question is phrased slightly differently, "how do I use IronPython in Visual Studio?". Just as with Python this question is not easy to answer, depending to a large extent on what IDEs you have used before and personal taste. It is further complicated in IronPython with the need for features from a .NET IDE and from a Python IDE in order to fully use the language and programming environment. Popular options include IronPython Studio (either integrated with Visual Studio or standalone), Visual Studio itself, SharpDevelop , Eclipse with the PyDev extensions and the Wing IDE from Wingware. All of these tools have different levels of support for working with Python, the .NET framework, and IronPython specifically. This article looks at all of these IDEs and their features. It also covers other editors, plus common tools for Python development (...

Multiple Inheritance in IronPython

Python allows for multiple inheritance , and therefore so does IronPython. With multiple inheritance you provide multiple base classes. As member resolution is done dynamically in Python, when you call a method the class hierarchy is searched to find the correct method. With single inheritance this is straightforward (the inheritance hierarchy is a straight line), with multiple inheritance the method resolution order is used to find methods. Multiple inheritance can be very useful where you really need it, but it also complicates your code. I believe it should be used rarely, but there are plenty of Python programmers who believe it should never be used. The most common use of multiple inheritance is to provide mixin functionality. It is often used in a similar way to interfaces in languages like C#. Simon Segal has written a blog entry describing multiple inheritance in IronPython, and how it interacts with inheriting from .NET types: C# classes for Mixins and Multiple Inheritance w...

Acceptance Testing .NET Applications with IronPython

Image
The July 2009 issue of Python Magazine is out, and the headline feature is an article on testing .NET applications with IronPython by the honourable Mr. Hartley . Brandon Craig-Rhodes (editor in chief) describes the article in his blog post on the July issue: The July 2009 issue of Python Magazine First, IronPython, the .NET version of Python for Windows, is the topic of Jonathan Hartley's article about acceptance testing. He illustrates that, regardless of the language in which you write your .NET application, you can deploy simple strategies to make your application testable through a Python test harness, and thereby bring Python's strong flexibility as a testing language to bear on a product that you might be writing in another .NET language. The article goes over some of the techniques we use for acceptance testing at Resolver Systems , but applies them to applications written in C# rather than IronPython.

A Good Mix 18: Amazon S3, Professional IronPython, Silverlight Spy, Loading Data from CSV Files and Sharepoint

A collection of projects, articles and blog entries on IronPython from the last few weeks. Lit S3 Commander 1.0 Lits3 is " a library written in C# that provides comprehensive and straightforward access to Amazon S3 for .NET developers ". The commander is a command line interface to LitS3, written in IronPython by Atif Aziz , and it just had a 1.0 release. Professional IronPython by John Paul Meuller This is a book by John Wiley due out on 20th April 2010. I can't find any other references to it on the net other than this Amazon.co.uk page, but it's been up for a while. Paperback: 504 pages Publisher: John Wiley & Sons (20 April 2010) ISBN-10: 0470548592 ISBN-13: 978-0470548592 I've not crossed paths with John Paul Meuller in the IronPython community, but it seems he's written quite a few technical books . Silverlight Spy with DLR Integration Silverlight Spy is a tool for doing runtime inspection of Silverlight applications: "Use the built...

A Good Mix 17: MUD, the Python for .NET that never was, Intellisense for IronPython, SciPy and Silverlight

Yet another selection of articles and projects on IronPython and the Dynamic Language Runtime from around the web. chiroptera This is the gitorious project page for a C# project: Chiroptera is a MUD client written in C# and uses IronPython as a scripting language. It runs on Windows and on Linux. Windows version has a graphical user interface. Linux version has a text interface with 256 color support. Charming Python: Inside JPython and Python for .NET Back way in the past, before 1.0, there was a previous Microsoft project to bring Python to the .NET framework. Unfortunately .NET pre-1.0 wasn't a good platform for dynamic languages and the project was never released. This article (from December 2000) is an interview with Mark Hammond who was the programmer on the project. Mark Hammond is familiar to most Python programmers because of his excellent development of the PythonWin environment and the PythonCOM extensions. And for the same reasons that we look up to Mark, Microsoft als...

Using IronPython in WPF to evaluate expressions

IronPython makes a ridiculously good expression evaluator, and for some reason it seems to get used a lot for adding dynamic features to WPF. For example see Using IronPython for Converters in Silverlight and Binding Dynamic Types with WPF . This Code Project article, by Sacha Barber, uses IronPython with WPF to evaluate mathematical expressions from C#. Using IronPython in WPF to evaluate expressions I have just read a little book on IronPython and thought it a pretty cool language. What I especially liked was the fact that it can be hosted in .NET as a script. This gave me an idea, wouldn't it be cool if we could use IronPython as a script to evaluate mathematical expressions for us and return a value. Think javascripts eval function, which is missing from C# (at least it is right now, it may be part of C# 4.0 who knows). So with this thought in mind I whipped up a small proof of concept and was actually very pleased with the results, so much so I have turned it into this articl...

A Good Mix 9: Cookbook recipes, articles and examples

Another selection of articles on IronPython from the last few weeks. Scripting: Reliably Finding my 32bit EXEs on a 32bit & 64bit OS or Where is IronPython? Saveen Reedy has a problem finding IronPython. More to the point he has an issue reliably finding the installed location when using both 32bit and 64bit versions of Windows (which have different standard install locations). Iron Python: How to talk to the .NET Framework A short blog entry demonstrating how IronPython integrates with the .NET framework by creating a simple GUI with Windows Forms and the interactive interpreter. The steps are virtually the same as I use when demoing IronPython to a .NET crowd. Creating Python Modules from CSharp This one is a bit meta, but still useful. It's a recipe I put on the IronPython cookbook and shows a 'slightly-different-from-the-usual' way to integrate C# with IronPython. It shows how you can use C# to programmatically create Python modules for use from IronPython. Back to ...