Getting started with PyTools and Visual Studio 2012

Let's face it, Visual Studio is THE best IDE around. IntelliJ IDEA comes to a close second for Java and Eclipse, it's too generic of a base class. I have been using IDLE for python which is ok until you start missing all the modern IDE features. In continued evolution of Iron Python, Python Tools for Visual Studio was created by a few Python and OSS enthusiasts at Microsoft’s Developer Division.

PTVS is a free/OSS plugin that turns Visual Studio into a Python IDE. Its Editing, Intellisense, Profiling, Parallel Debug & Watch, Live Debug REPL, MPI & Cluster Computing and Refactoring capabilities are fairly neat. PTVS claims to support CPython, IronPython, Editing, Browsing, Intellisense, Debugging, Profiling, HPC Clusters, Multiple REPL’s, IPython, Django, and Cloud computing with Client Libraries for Windows, Linux and MacOS.

Among the best features beside being able to put a break point in the code and step through, is the capability to open an existing python library from the source.

Get your existing python library and you can get a .sln out of it in couple of minutes flat; it just works. I was able to get Dr. Szymon Jaroszewicz's belief networks library up and running in few minutes.

Once you have the solution, you can add additional libraries as part of search path.

 

to avoid getting exceptions

exceptions.ImportError occurred Message: No module named <module name>.

You can start a simple project which uses numpy with a simple start->new project. Numpy is great for performing calculation relying heavily on mathematical and numerical operations. Here I will be calculating an Eigen vector.

If you have never used it, numpy works natively with matrices and arrays, perform operations on them, find eigenvectors, compute integrals, solve differential equations.

Put couple of break points and push F11 and viola.

So this is a quick intro to Python tools for visual studio. For more in-depth review, check out Python Tools for Visual Studio on codeplex.

Happy coding.

Share