Yesterday I found that JetBrains released a new Early Access Program build (build 96.1203) of PyCharm, the newest multiplatform (Windows, Mac OS X, Linux) Python IDE,
They’ve made a lot of progress since I last checked and so it’s a good opportunity to give it a quick try and share my experience.
First, I downloaded the preview build (pycharm-96.1203.exe).
After installation, it will appear under the folder JetBrains in the Start Menu
Obligatory splash screen …
After it fully loads, you’ll be presented with this start experience.
We’ll start by creating a new project in the Quick Start area
As you would expect this can also be done from the File menu
You’ll be presented with this dialog to provide a name and a location for the project.
(Note to all developers: Don’t set the default for a file to the root of the user profile as shown below (“C:\Users\saveenr\PycharmProjects\untitled”). To be a well-behaved application on Windows you should default to the user’s My Documents folder (and of course use the correct APIs to find out where it is). Below the correct location should instead be “C:\Users\saveenr\Documents\PycharmProjects\untitled”.
We have some options for the kind of project to create. I just chose Empty project because I have no experience using Django or Google App Engine.
Once you click OK, you’ll notice that PyCharm is inspecting your environment.
And finally the project is ready. Obviously not much going on there, which is appropriate because I did choose “Empty project” initially.
Examining the Project window will reveal that it discovered by “IronPython 2.6” (for .NET 2.0) installation but not my “IronPython 2.6 for .NET 4.0” installation nor my CPython 2.7 installation.
it’s not clear why a negative number shows as one of the nodes. I’ll assume this is just a bug.
Let’s add a file by right-clicking on the untitled node and selecting File/New
I gave it the name of “main.py”
No surprise, an empty python file is created.
I’ll paste in some IronPython code I wrote to automate Visio back in 2008.
The original blog post is here: http://blogs.msdn.com/saveenr/archive/2008/10/20/visio-automation-three-hello-world-samples-c-f-and-ironpython.aspx
The code is very simple but it will show how well PyCharm works with IronPython
import sys import clr import System clr.AddReference("Microsoft.Office.Interop.Visio") import Microsoft.Office.Interop.Visio IVisio = Microsoft.Office.Interop.Visio visapp = IVisio.ApplicationClass() doc = visapp.Documents.Add("") page = visapp.ActivePage shape = page.DrawRectangle(1, 1, 5, 4) shape.Text = "Hello World"
To run …
Which brought up this window that frankly surprised me
But it was clear that I simply had not selected “main.py” before I tried the run command. So I selected main.py and tried again…
Clicking on main …
Notice the new window at the bottom.
So the script ran and the correct thing happened – Visio was launched an a single rectangle was created with the text “Hello World”
I had mixed results with completion in the editor.
I really wasn’t expecting it to work with objects created at runtime (“doc”, “shape”, “page”), but was hoping that PyCharm was going to do a little type inference to help out.