Python Tools for Visual Studio

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. 


Comments (28)

  1. it is a good news ,got it. says:

    got it.

  2. henning says:

    totally unexpected, but way, way cool. way to go, microsoft 🙂

  3. Jeff says:

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

  4. Marc Sigrist says:

    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, …).

  5. Craig says:

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

  6. Jim de Graff says:

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


    Traceback (most recent call last):

     File "", line 62, in <module>

       import os

     File "", line 1, in <module>

       from Tkinter import *

     File "", line 38, in <module>

       import FixTk

     File "", line 49, in <module>

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

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


  7. alexandr says:

    my programm-consist three parts:


    visual basics and acess.

    data base.

    capacity organizations.

    design picture/

    economics and optimizations parametr models structure menegment.

  8. says:


  9. 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 it seems like it should be impossible for Python to start w/o having an os.path module.

  10. 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:…/162 – PyLint…/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!

  11. toub says:

    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.

  12. Octagon says:

    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?

  13. AndrewDover says:

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

  14. 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.

  15. Octagon says:


    Re: suggestions. I see. Personally, I would redo the analysis if there is any new input and the dot is typed, but it is good enough as is.

    Re: maketrans. Yes, it is a 3.2 thing. I tested it since I knew about the Eclipse problem with does suggesting uppercasing words and this one. Both are 3.something, so when I saw the correct suggestion for words uppercasing I was surprised seeing the translate dictionary missing. Personally, I guess it is better to ping/encourage the Iron Python team one more time than make some quick fix.

    Re: : after def. I hope there are more important things to do. I just wanted to find something where Eclipse was ahead, just to feel the comparison was balanced, and that was all I found.

  16. Sumit Kumar [MSFT] says:


    The next version of Visual Studio will not have refactoring support for C++. But it is high on our list of things to do in future releases. Thanks for making the feature request.

  17. Tahsin says:

    We can't install this if we only have Express edition, right? So we have to first install Visual Studio Integrated Shell?

  18. Octagon says:

    Guess I found ashow stopper. With a Python project, when I paste international utf-8 text into a .py file or type international charachters in the editor, the editor attempts to convert them into non-unicode. There is no configuration setting to revert that ancient behavior back to normal.

    It's funny, that if I open the same .py file in a C# project, enter a char that cannot be converted to non-unicode, and save the file, I get a dialog that allows to save as Unicode and after that THE SAME file works fine in a Python project. That is, Python tools understand the Unicode BOM, but does not allow to create files with it.

  19. Tuwogaka: We're looking at adding the same prompt C# gives you to add the BOM.  Please vote on this issue…/107 although at this point I think it's pretty likely we'll do this for 1.1.

    For the time being rather than going to a C# project to get a file w/ a BOM you can use File->Save as to save with an encoding and get the BOM added.  In the save dialog click on the chevron next to the Save button, and then select Save with Encoding.  You can then select Unicode (UTF-8 with signature).

    We've also already made some changes for 1.1 to improve this.  We'll now use the encoding specified in a PEP 263 # coding: line to recognize the encoding.  This is the more univeral method for Python files to specify their encodings as the BOM is mainly only seen on Windows.  And we also now default to an ASCII encoding (which is what the Python interpreter expects w/o a BOM or # coding line) instead of your current locale for the encoding.  My initial experiments show that this is successfully roundtripping Unicode chars although I haven't tested it exhaustively.

    Thanks for the feedback!

  20. Interesting development, why I have a feeling that Visual Studio will support all kind of language in future, its catching up eclipse pretty quickly in the area of versatility. And hope fully this continuous growth will sustain.



  21. __GetReal__ says:

    <<<<<<<We can't install this if we only have Express edition, right? So we have to first install Visual Studio Integrated Shell?>>>>>

    welcome to my web said the spider to the fly…

  22. kevin says:

    Loving it. A great job! very cool.


  23. Tommy says:

    personally I love it – once I've started developing with pytools… can't be stopped! such a comfort…

  24. Jack Dismal says:

    I really enjoy your plug-in PTVS 2.0 Alpha. It gives me all the benefits of VS while allowing me to use Python. Thank you for developing such a great tool!

    In the future I would love to see syntax highlighting for DefNames and Classes as well as different variables. I see that PTVS can tell the difference ( by mousing over the different kinds, the tool tip can tell the difference ), so it would be awesome to be able to context color code these differences as well!

    Keep up the great work!!!

  25. FB says:

    I've been scratching my head trying to plan my move from Matlab to Python. A great IDE was my biggest concern. You may have just made my day! 🙂

Skip to main content