BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Package Management for Python Tools for Visual Studio

Package Management for Python Tools for Visual Studio

Microsoft is continuing its efforts to support Python in Visual Studio. Still in beta, Python Tools for Visual Studio 2.2 (PTVS) brings more of the standard features found in other VS supported languages such as C# and VB.

First on the list is Task Comments. This is a surprising one because on the surface the functionality seems so simple. All it does is scan for comments that begin with certain keywords (TODO and HACK by default) and adds them to the integrated task list.

Next up is the ability to collapse code, also known as “outlining”. Steve Dower writes,

This has probably been our most popular request ever, and so we've added it. Now you can collapse almost anything that spans multiple lines, no matter where they are in your code. This includes functions, classes, lists, dictionaries, loops, exception handlers, and even multi-line strings.

He goes on to say that Python will also support regions. Since # is already a comment character in Python, Visual Studio can honor lines that begin with #region without actually changing the language.

This brings up one of the limitations that the Visual Studio developers face. Languages that were created for .NET such as VB, C#, and F# were also created specifically to allow for good IDE experiences. And if the IDE needs something, the language can often be changed to accommodate it. But changing Python, with using comment tricks, is simply not feasible. Not only would Microsoft need to request a change to the standard, they would have to wait until most or all of the various implementations of Python catch up.

Something that Microsoft can offer is code snippets. These work the same way in Python as they do in C# and VB. New snippets can be added by developers as usual and optionally submitted to Microsoft to be included in future versions of PTVS.

Package Management

The Environments window in Visual Studio has received a face lift. Besides making it easier to see which environments are installed and access their interactive windows, it now supports package management. The Python equivalent to NuGet is the Python Package Index, which you can now search directly from Visual Studio.

Debugging

In the realm of debugging, PTVS is starting to catch up. Breakpoints now support counters, which are useful when debugging loops or spot-checking frequently called functions.

The Autos window is also supported now. For non-VS users, Autos is basically a watch window that is automatically updated based on the last line that was executed. Generally speaking, it will display local variables and expressions near the current line indicator.

Python Tools for Visual Studio is available for VS 2013 and VS 2015 CTP 6.

Rate this Article

Adoption
Style

BT