Python Tools for Visual Studio

Python Tools for Visual Studio

Rate This
  • Comments 24

Today, I’m excited to announce the release of Python Tools for Visual Studio (PTVS), which is now available for download from CodePlex.

The Python ecosystem has been enjoying tremendous growth over the past few years, attracting all types of programmers from scientists to web developers to hobbyists. To support this growing community, we’ve released PTVS, an extension to Visual Studio that provides for Python the wealth of features developers desire in a modern and mature IDE. PTVS is aimed at enthusiast and professional Python developers alike. PTVS also includes features specialized for technical computing. Over the past several months, I’ve blogged about multiple projects related to our technical computing initiative, including Solver Foundation, Dryad, and TPL Dataflow.  PTVS is another unique and exciting project in this area. It's a free extension to Visual Studio that can be used with the Visual Studio Integrated Shell (available for free download) as well as with Visual Studio Professional and higher.

Key PTVS features include:

  • Support for CPython, IronPython, Jython, and PyPy
  • Advanced editing capabilities, including IntelliSense
  • Multiple refactorings, such as “Extract Method”
  • A built-in REPL (read-eval-print loop) window
  • Debugging and profiling capabilities

Visual Studio has a great editing experience, and with PTVS this experience now extends to the Python language.  Capabilities begin with basics like syntax highlighting and extend to support for the navigation bar and object browser.  It provides IntelliSense for your Python code based on a deep analysis of either your project or a directory of files, including understanding your classes and methods and peering into how you’re using core Python data structures like lists, tuples, and dicts.  Additionally, based upon the same analysis used for IntelliSense, PTVS provides “Find all References” and “Go to Definition” features, which allow you to quickly navigate your code.  You can get a sense for the editing experience from this screencast.

PTVS also includes refactoring support to make you more productive.  This release automates two commonly needed refactoring patterns: “Extract Method” and “Rename Variable”.  Extract method enables you to quickly excerpt a code snippet into a new method, making your code more readable and enabling better reuse.  “Rename Variable” will rename all usage of a specified symbol in your code, supporting locals, module globals, and classes.

One of the most important aspects of Python development is interactivity, and PTVS integrates a Python REPL directly into Visual Studio.  The REPL window will work for all of the aforementioned Python variants and supports auto-completion, syntax highlighting, and visualizations.  For users accustomed to the enhanced REPL provided by IPython, PTVS supports IPython 0.11.  For developers using IronPython, the REPL supports Sho.

One of the main focuses of our technical computing efforts has been parallel and distributed computing, and this PTVS release includes multiple features targeted at this area.  In addition to standard debugging support, PTVS enables MPI cluster debugging.  With this you can create a Python application and easily debug it on your Windows HPC cluster.  Press 'F5', and your application will be deployed to the cluster and launched with debugging support.  You’ll then be able to debug across all of the relevant processes across all of the involved nodes.  This provides a great development experience when doing high performance computation in Python.

Beyond debugging, with PTVS integrated into Visual Studio Premium or higher, you also get a great profiling experience similar to that provided for C#, Visual Basic, C++, and JavaScript.  After running with the profiler enabled, you’ll be presented with graphs and charts that help you to quickly find the hot spots in your program.

I'm also excited to inform you of the availability of the NumPy and SciPy Libraries for .NET.   This port to .NET by Enthought, Inc. enables IronPython and other .NET languages to take advantage of these important technical computing libraries which support mathematical, engineering, and scientific domains.

Finally, I’d like to highlight that PTVS is open source, released under the Apache 2.0 license.  I encourage your participation in this exciting Python project, and we look forward to hearing your feedback on the effort. 

Namaste!

Leave a Comment
  • Please add 6 and 8 and type the answer here:
  • Post
  • cool!

  • got it.

  • totally unexpected, but way, way cool. way to go, microsoft :)

  • I've been using the python tools for about a month and am loving it. You guys did a great job!

  • Great News for Python users. Let's hope that the tool support for F#, which is one of the default VS languages, will be improved as soon as possible (better intellisense parameter info, refactoring, ...).

  • Nice! Now let's get some PyFlakes integration with the IDE.  Anyone already working on this?

  • I installed it and it immediately broke my Active Python installation. Not impressed.

    C:\Users\Jim>python

    Traceback (most recent call last):

     File "C:\Python27\lib\site.py", line 62, in <module>

       import os

     File "C:\Python27\lib\os.py", line 1, in <module>

       from Tkinter import *

     File "C:\Python27\lib\lib-tk\Tkinter.py", line 38, in <module>

       import FixTk

     File "C:\Python27\lib\lib-tk\FixTk.py", line 49, in <module>

       prefix = os.path.join(sys.prefix,"tcl")

    AttributeError: 'module' object has no attribute 'path'

    C:\Users\Jim>

  • my programm-consist three parts:

    physics.mehanics.literatute.

    visual basics and acess.

    data base.

    capacity organizations.

    design picture/

    economics and optimizations parametr models structure menegment.

  • Nice!

  • Jim de Graff: It shouldn't have done anything that would have broken your ActivePython install as it won't modify a Python install at all.  Do you have ActivePython 2.7?  Do you have a PYTHONPATH env var set?  If you start Python w/ -S does "import nt" work?  Looking at os.py it seems like it should be impossible for Python to start w/o having an os.path module.

  • Craig: No one is working on this yet.  We have a couple of issues to track PyFlakes like support, nothing in particular calling out PyFlakes though:

    pytools.codeplex.com/.../162 - PyLint

    pytools.codeplex.com/.../1   - Update our analyzer to provide support for common mistakes

    Either way we're not planning on doing either of those features for our next release.   If this is something you're interested in and would like to contribute back a change we'd love to see it!

  • Marc Sigrist: thanks for your interest in F#.  For the next release, one of the big priorities for the F# team has been to improve Visual Studio tooling for the language. Refactoring support is unlikely to come anytime soon, partly because it is far more challenging to implement for a language like F#, but the F# team has been focused on improving the correctness and performance of IDE features such as IntelliSense and Parameter Help.

  • Withonly CPython 3.2 installed, I tested the magic displayed in the video and yes, f('asssa'). suggests string methods, but if I just select 'asssa' and type 43, f(43). still suggests string methods. If I first backspace to f(, then f(43). suggests correct methods.

    I also got no maketrans suggestion in q = bytes.maketrans(b'abc', b'dsa')

    Anyway, coooooool!

    Python tools for Eclipse automatically add : after def and from after import. Is it something to be implemented in the next version?

  • How about refactor “Rename Variable” for C++ ?

  • Tuwogaka: You may need to give it a second for the analysis to kick in and re-analyze.  By default there is a 1 second delay between typing and re-analyzing.  Also pressing enter will cause the analyzer to kick back in immediately.  So if you very quickly enough change the type and then bring up completions you will see the stale result.

    Regarding maketrans: Is the issue here the lack of signature help or the lack of completions for maketrans at all?  Currently we base a lot of our completions upon metadata pulled from IronPython where we get the signature info.  That's based on 2.x so we don't have the signature help.  But once the analysis of the 3.x interpreter completes we should at least give you member completion for maketrans even though we don't have signatures.   We have an active work item to ship w/ a 2.x and a 3.x database so this will be better in an upcoming version.

    Regarding the : after def.  We don't have any immediate plans to add this ourselves and I don't think we have a feature request tracking it either - feel free to open one.  Also, if you'd like to contribute it we'd love to see it!  It's also something that can probably be added through an external extension similar to how you can get extensions for C# that automatically insert curly braces.

Page 1 of 2 (24 items) 12