Refactoring and Profiling Python with Visual Studio
Microsoft’s Developer Division has released a release candidate of Python Tools for Visual Studio. In addition to supporting refactoring in CPython and IronPython, this release offers support for MPI (Message Passing Interface) and Microsoft HPC (High Performance Computing). Visual Studio Ultimate owners also get a profiler for CPython.
According to the HPC & Cloud Features walkthrough posted on the project site, there are two ways scale your computations using Python.
- Batch mode: Via MPI, using the MPI4PY wrappers on a cluster
- Interactive mode: Via the integrated IPython Shell on a cluster (or by using IPython by itself)
While the MPI standard was primarily designed for use with clusters and supercomputers, there are other ways to leverage it. For testing purposes an multi-core development machine can be sufficient for reasonably small workloads. Another option is to “Cluster of Workstations” where in PCs use idle cycles for processing data. (The most famous example of this idea is the SETI@home project.)
IPython is a “comprehensive environment for interactive and exploratory computing” with a heavy emphasis on parallel programming. IPython runs on top of any Python 2.6 interpreter including IronPython and PyPy.
Python Tools for Visual Studio also supports many of the standard features one would expect. Built-in project templates are available for
- Python/IronPython Console Applications
- Python MPI Applications
- IronPython with WPF
- IronPython with WinForms
For a dynamic language the Intellisense support is quite robust. “The type inference is control flow independent and works across function, class, and module boundaries and is updated in real time while you’re developing your application.” There is also support for the navigation bar, “go to definition”, and “find all references” features. The refactoring support we mentioned in the headline is new in this release. Currently is supports renaming and method extraction. The Object Browser is also supported, with the method signatures displayed using Python syntax.
The debugger works with CPython, IronPython, and Python MPI and has the normal support for breakpoints and variable exploration.
Martin Thompson Jul 27, 2014