IronPython 2.7 and PTVS

The number of new features for Professional IronPython keep increasing as I discover more about IronPython updates from the community. You may have read my PTVS post the other day and wondered just how it was that the PTVS installer didn’t detect my IronPython 2.6.2 setup. It turns out that the PTVS installation currently has some problems. The best course of action is to uninstall PTVS and your IronPython 2.6.2 installation as well. (Make sure you reboot your system after you uninstall the old products.) What you really need is to download and install IronPython 2.7 Release Candidate 2.

Start the installation after you complete the download. You’ll see the normal licensing agreement and so on. However, the important feature to observe are the options on the Custom Setup page shown here:

IP2702

Notice the Tools for Visual Studio entry. Installing this feature ensures that you get all four of the templates in Visual Studio 2010. Once you complete the installation, you can check it out in Visual Studio. Here’s the updated New Project dialog box from my copy of Visual Studio 2010 Ultimate:

IP2701

So, now I have a number of new toys to play with. Future blog entries will describe what I find when I try the other templates out. In the meantime, I’d love to hear about your experiences with PTVS at John@JohnMuellerBooks.com.

 

Using the PTVS for a Simple Project

Well, I installed the PTVS I mentioned in yesterday’s post on my system and gave it a whirl. I must admit to being a little underwhelmed after the hype on the CodePlex site. However, the download does help and if you want to use Visual Studio for your development platform you should get it.  The process for creating a project is certainly easier than then one described in Chapter 2 of my book (although, that process still works fine for existing projects). The first thing you’ll notice after installation is that you get a new installed template as shown here.

PTVS01

As you can see, you do get all of the functionality that you’d normally get in a Visual Studio project, including the ability to add your application to source control, so this is a good start. After you configure your solution, the IDE creates it for you and you see a single file with some test code in it like this.

PTVS02

Don’t get the idea that you can simply click Start Debugging at this point and see something interesting. Before you can do anything, you have to configure the interpreter. Choose Tools > Options to display the Options dialog box. In the Options dialog box, select the Python\Interpreter Options folder. Here’s what the options look like; I’ve already configured mine for use on a 64-bit Windows 7 system.

PTVS03

I found that IntelliSense worked great. For example, when I typed raw_input(, I automatically received the proper help as shown here.

PTVS04

I played around with the IDE quite a lot more and was impressed with what the IDE does now that it didn’t do in the past. Of course, I’m going to have to play a lot more before I feel comfortable with everything this add-in can do.

So, where was the disappointment factor? Well, the first issue is that I was supposed to receive a total of four template types with IronPython according to the ReadMe.html file that comes with the product. I’m hoping there is a simple fix for this issue because I’d really like to tell you about the other templates that PTVS supports. The second issue is that the IDE didn’t automatically recognize my interpreter as it should. I’m assuming this is the reason why I didn’t receive the additional template. I’ll report back about these issues and show you more about PTVS as time permits. In the meantime, let me know your thoughts about PTVS at John@JohnMuellerBooks.com.

 

IronPython Finally Has Visual Studio Support

Months ago when I wrote Professional IronPython, I had to show you all kinds of workarounds for seemingly simple problems because the Visual Studio IDE didn’t provide the support required to do things like create an IronPython project.  For example, in Chapter 8 I have to show you how to create a Windows Forms application without using the visual designer.  That’s right, you need to write all of the component code manually, rather than rely on the GUI.  Microsoft’s decision not to support IronPython and IronRuby any longer seemed to put a nail in a great product’s coffin and I thought that perhaps the days of IronPython were numbered.

Fortunately, I was wrong. Microsoft has finally decided to release a beta add-in for Visual Studio 2010 that provides IDE support for both CPython and IronPython called Python Tools for Visual Studio (PTVS). You’re not getting any sort of new functionality from the language perspective.  The add-on relies on the underlying language features to perform its work.  The benefit to using this add-in is that it allows you to use the IDE to perform tasks such as creating an application using a template, rather than coding everything by hand.

Of course, the add-in provides far more functionality than simply creating projects.  The fact that I now get IntelliSense support is amazing.  You don’t know how helpful an IDE feature is until you try to write code without it.  Over the years, I’ve become somewhat addicted to IntelliSense because it helps me “remember” what it is that I want to do next.  Otherwise, I have to sit there and think about how things are supposed to go together; not always an easy task when you regularly work with multiple languages.

The add-in must be striking a chord with everyone.  It was only released on the 7th and there have already been 1,380 downloads (as of yesterday when I downloaded my copy).  If you program with IronPython and you often use IronPython to overcome procedural language limitations, this is a must have add-in for Visual Studio.

I’ll be working with this add-in over the coming weeks and will report back on what I find.  In the meantime, I’d love to hear your input on it at John@JohnMuellerBooks.com.