Freigeben über


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. 

Namaste!

Comments

  • Anonymous
    August 29, 2011
    cool!

  • Anonymous
    August 29, 2011
    got it.

  • Anonymous
    August 29, 2011
    totally unexpected, but way, way cool. way to go, microsoft :)

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

  • Anonymous
    August 30, 2011
    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, ...).

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

  • Anonymous
    August 30, 2011
    The comment has been removed

  • Anonymous
    August 30, 2011
    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.

  • Anonymous
    August 31, 2011
    Nice!

  • Anonymous
    August 31, 2011
    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.

  • Anonymous
    August 31, 2011
    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!

  • Anonymous
    August 31, 2011
    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.

  • Anonymous
    August 31, 2011
    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?

  • Anonymous
    August 31, 2011
    How about refactor “Rename Variable” for C++ ?

  • Anonymous
    August 31, 2011
    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.

  • Anonymous
    August 31, 2011
    DinoV: 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.

  • Anonymous
    September 01, 2011
    The comment has been removed

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

  • Anonymous
    September 02, 2011
    Tahsin: Absolutely correct

  • Anonymous
    September 03, 2011
    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.

  • Anonymous
    September 03, 2011
    The comment has been removed

  • Anonymous
    September 04, 2011
    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. Regards, Masudur  

  • Anonymous
    February 29, 2012
    <<<<<<<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...

  • Anonymous
    March 25, 2012
    Loving it. A great job! very cool. Kevin http://www.okawards.com

  • Anonymous
    October 28, 2012
    personally I love it - once I've started developing with pytools... can't be stopped! such a comfort...

  • Anonymous
    December 08, 2012
    its good

  • Anonymous
    March 19, 2013
    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!!!

  • Anonymous
    April 18, 2013
    The comment has been removed