Live data from Hacker News

Show HN: Python Tools for Visual Studio

pytools.codeplex.com

11–20 of 56 posts

Re: Show HN: Python Tools for Visual Studio

#11
"Send to Interactive"[0]

In general, is there a particular reason we don't see this more often in tooling for other (REPL-friendly) languages, outside of the Lisps? Admittedly I haven't spent a significant amount of time in the Python community lately (so not sure if this is common in Python tooling or not), but after becoming addicted to SLIME via Clojure, I'd have killed to be able to dump Ruby blocks from my editor straight to the REPL.

[0] http://pytools.codeplex.com/wikipage?title=Features%20Intera...

Re: Show HN: Python Tools for Visual Studio

#12
Really really impressive! Django development on windows is a PITA (compared to linux/mac), and all other (free) IDEs that I've taken a look at haven't really given me too much. I'll definitely give this a go for a test application to see what it does for me.

Re: Show HN: Python Tools for Visual Studio

#13
post #8

One of the few times I've felt jealous as a Linux user :) Really cool, I love the a={2:42} a.values()[0]. example. What are the limitations of such a system in Python? Are there cases where it can be wrong? Can you reveal some more info on how this stuff works under the hood? Do you execute parts of the code or how do you figure these relationships out? Thank you, it's pretty inspirational in regards to how programmi…

Roughly the same example (type inference from literals and type tracking through containers) in KDevelop, KDE's IDE, obviously available for Linux: http://simplest-image-hosting.net/png-0-i12983

KDevelop's Python plugin is currently in early beta stage, but already offers one of the most sophisticated implementations of interactive static analysis for Python currently available. Meanwhile, if you like C++, it's already rock solid and second to none :). It's noteworthy that two languages that different can be catered to with best-in-class semantic support by the same underlying language plugin framework.

In regards to how this is done, KDevelop works purely statically. One of the smartest Python IDEs on the market, Wing IDE (also available for Linux) implements a hybrid approach of static analysis and gathering additional information by instrumenting programs at runtime. However, KDevelop's static analysis figures out a lot more than Wing's does.

ETA: Since Ruby support was asked about elsewhere in the thread, I thought I'd add that a Ruby support in KDevelop is also in the works in earnest as of this summer, but currently not yet as far along as Python support. The other production-ready language plugin next to C++ (which is KDE's bread and butter as a community) is the PHP one, which supports everything up to PHP 5.4 (i.e. including namespaces).

Re: Show HN: Python Tools for Visual Studio

#14
post #2

Hi folks, if you happen to be on Windows & enjoy Python, please check out our latest release of PTVS. It's a free/OSS plug-in for VS which supports CPython, IronPython, and the usual Edit/Debug/Profile/etc. now with Django & Client Libs for Linux & MacOS as well. Another cool feature we've added is the Parallel Stack / Watch view and Django template intellisense/debugging. Disclaimer: PTVS is built by few Python/OSS…

[deleted]

Re: Show HN: Python Tools for Visual Studio

#15
Looks great! I don't use Python, but I do use Visual Studio every day and this looks like a really complete implementation.

Did you find that Visual Studio easy to integrate with, or did you have to fight it to do what you wanted?

Re: Show HN: Python Tools for Visual Studio

#16
post #2

Hi folks, if you happen to be on Windows & enjoy Python, please check out our latest release of PTVS. It's a free/OSS plug-in for VS which supports CPython, IronPython, and the usual Edit/Debug/Profile/etc. now with Django & Client Libs for Linux & MacOS as well. Another cool feature we've added is the Parallel Stack / Watch view and Django template intellisense/debugging. Disclaimer: PTVS is built by few Python/OSS…

This looks fantastic. Do you know if there's any kind of similar implementation for Ruby? Would it be terribly complicated to do something similar for Ruby or a different dynamic language?

Re: Show HN: Python Tools for Visual Studio

#18

"Send to Interactive"[0] In general, is there a particular reason we don't see this more often in tooling for other (REPL-friendly) languages, outside of the Lisps? Admittedly I haven't spent a significant amount of time in the Python community lately (so not sure if this is common in Python tooling or not), but after becoming addicted to SLIME via Clojure, I'd have killed to be able to dump Ruby blocks from my edito…

I'm currently struggling to find a satisfactory IDE for python for this exact reason. This seemingly obvious feature has to be hacked on to just about every popular coding tool. The best things I've found so far are the ipython web notebook (the only problem being that it stores my code as JSON and has poor/no keybindings) and emacs python-mode (which is buggy as all hell).

NB: The only tool I've ever found that works in the manner I want it to as far as REPL languages go is RStudio. If I had an RStudio that was language agnostic so it could work with python, ruby, lisps, or what have you, I would be a happy, happy man.

edit: if anyone has any suggestions in this regard, please, leave a comment!

Re: Show HN: Python Tools for Visual Studio

#19
post #2

Hi folks, if you happen to be on Windows & enjoy Python, please check out our latest release of PTVS. It's a free/OSS plug-in for VS which supports CPython, IronPython, and the usual Edit/Debug/Profile/etc. now with Django & Client Libs for Linux & MacOS as well. Another cool feature we've added is the Parallel Stack / Watch view and Django template intellisense/debugging. Disclaimer: PTVS is built by few Python/OSS…

I love PTVS, but I keep running into a problem when I debug my code. One time it'll properly highlight in my IDE where an exception (or breakpoint) occurred; the next time it won't, and I have to look in the black Python console window and inspect the stack trace . Using PTVS 1.1.50530.0 with VS2010 Ultimate.

Re: Show HN: Python Tools for Visual Studio

#20
post #8

One of the few times I've felt jealous as a Linux user :) Really cool, I love the a={2:42} a.values()[0]. example. What are the limitations of such a system in Python? Are there cases where it can be wrong? Can you reveal some more info on how this stuff works under the hood? Do you execute parts of the code or how do you figure these relationships out? Thank you, it's pretty inspirational in regards to how programmi…

We don't actually execute any code to figure this out, it's all based upon analysis of the code.

Basically how it works is that we do an abstract interpretation of the code. To take this specific example first we analyze the a = {2:42} line, and the dictionary literal produces a new unique value in the system, and obviously we know it's key/value types. From there we'll analyze the "a.values" which will produce a new value in the system for the bound "values" method. Then we do an abstract call on that, and it says that it returns a list (and goes off to the original dictionary value, and produces a list which contains the int objects). And then we do the indexing, and finally we get back the original 42 value that the dictionary was created with. So basically at each step along the way we are just propagating sets of abstract values. A naive implementation of a system like this would iterate until it hits a fixed point - we're a little more sophisticated in that we do a bunch of dependency tracking to know what needs to be analyzed based upon changes in the system. And then we also need to deal with a user editing the program in real time which makes things even more complicated as we need to discard old stale information which has been propagated from edited files. The actual implementation of the basic Python semantics is actually the easy part, it's getting this to perform on large programs and working correctly with live editing which is the difficult part.

This can go wrong in a couple of ways. First off we don't model control flow, so you could have something like:

if False: a = 42 else: a = 'bar'

And we'd think that a was an int or a bar. In the future we might model control flow, but it's a big feature. Mainly I just need an excuse to implement it :). Another way it could go wrong is if the user is using exec/eval which we don't have any insight into. And finally there can be things that we simply don't understand. So while we know about the primitive types and the methods on them, we don't model all of Python's built-in types. So for example if you're using deque in collections you won't get the same results.

All of this is open source (under the Apache license) and the parser and analysis engine are entirely stand alone components, so they could even be re-used by other IDEs. You can check out the source code over here: http://pytools.codeplex.com/SourceControl/changeset/view/3b8...

Post reply on HN