
Python Tools for Visual Studio - numo16
http://www.hanselman.com/blog/OneOfMicrosoftsBestKeptSecretsPythonToolsForVisualStudioPTVS.aspx
======
CurtHagenlocher
This doesn't even mention the most awesome feature of PTVS 2.0: mixed-mode
debugging, which provides an integrated experience for debugging mixed
Python/C processes. See [https://pytools.codeplex.com/wikipage?title=Mixed-
mode%20deb...](https://pytools.codeplex.com/wikipage?title=Mixed-
mode%20debugging) for details.

Disclaimer: I used to work on IronPython.

~~~
ibejoeb
Microsoft really does make the most outstanding developer tools. I admit that
I occasionally miss that deeply integrated, seamless feeling.

You guys deserve some recognition. I'm not too frequent a user lately, but I'm
continually impressed.

~~~
NicoJuicy
I'm developping on some platforms.

But i have to admit, nothing beats visual studio in awesomeness / completeness

~~~
wwweston
I came into a shop that does a lot of .NET development over a year ago, and I
swear I came into the experience hoping to learn what made lots of people say
exactly what you've said.

6 months into it, I all but stopped caring, and overall, I felt like it
actually created problems for me. But I'd like to understand what problems
others feel it solved for them.

~~~
pnathan
Honestly, coming into visual studio/c# from emacs/common lisp feels like going
backwards in time for me.

Running my CL environment on Gentoo feels like the future; a not-quite-there-
yet-but-still-awesome future; running VS on Windows feels like kiddie toys
that haven't gotten around to growing up yet.

And that's a weird feeling when you realize the dollars, time, and research
poured into each environment. :-)

~~~
sultezdukes
That's funny because I feel the same way if I have to use Emacs. It feels like
going back to the early 90s with some DOS Borland IDE.

Regular text editors just feel so clunky next to the cohesiveness of
VS/Resharper or Intellij.

At some point in time, Emacs is going to have get overhauled to join the 90s,
much less the 21st century.

And I understand that CL is a special case with Emacs, but it's still clunky
as hell compared to what could have been really awesome environments (think
Smalltalk environments), but with lots of resources pumped into the
development.

~~~
snuxoll
> Resharper

You've kind of hit the key here, Visual Studio alone is decent, but Resharper
is really what makes the experience for me. I don't know a single .net
developer who could live without it.

~~~
kryten
There's one here.

It stinks on our 1Mloc C# project to the point you have to disable it or it
crashes VS every 5 minutes.

------
ww520
Another Microsoft's best kept secrets is using Javascript for shell script. It
has been there forever since Javascript first came out. It's called JScript
but it's just Javascript with Windows support like running ActiveX Objects,
which let you access the file system, OS, network, etc. You can pretty much
drive the Windows system with it through ActiveX Automation. Also you can do
Office application integration like Excel Automation with it.

~~~
drmohundro
Related, but for the same reasons, you could also write classic ASP using
JavaScript (as opposed to VBScript). Years ago, I spent months trying to
convince my team to let me use JavaScript instead of VBScript in our ASP
files.

~~~
ww520
I know. When I need to do some Windows scripting, I'd do it in JScript rather
than VBScript. Like when a user wants to merge two Excel files, nothing beats
to whip out a simple JScript to do it. Running it is simple. They just double
click on the JScript file and done. Business users love it.

------
jroseattle
For me, Msft and JetBrains provide the best IDEs for getting work done. The
majority of my work is in Java, C#, and Python.

At the moment, I use PyCharm for python projects because I'm usually working
on OSX (and prefer the local unix-y environment instead of the Windows-
virtual-machine thing.) However, I started with PTVS years ago and really like
it.

MSFT adding IDE support for Python is a good thing -- as developers, we need
more options, not less.

~~~
loudmax
MSFT porting VS to Mac and Linux would give developers even more options.

~~~
devcpp
...which would be detrimental to Microsoft. Limiting our options to theirs is
precisely their goal by giving us a great IDE that only works on Windows.

They're never gonna go it. They stand to win nothing from that.

~~~
sosuke
I dunno, I might just be cost prohibitive to port, and likely wouldn't run as
well.

~~~
redblacktree
Even on a modern, high-powered laptop, Visual Studio still runs slowly for me.
Some actions inexplicably cause the UI to hang for a few seconds. I really
appreciate how OSX seems to prioritize UI responsiveness, which doesn't seem
to be the case in Windows.

~~~
ryanmolden
Do you have specific examples? This is an area of interest for me. VS
architecturally has a lot of things tied to the UI thread due to COM STA
requirements (well, that and the fact that historically people created their
STA objects on the UI thread, thus tying them to the UI thread).

Another possible cause can be extensions. Not that VS doesn't have its own
problems of 'doing too much work on the UI thread', but there are TONS of
callback points that third parties can hook into, and lots of times people do
very ill-advised things on the UI thread, leading to poor responsiveness.

We monitor it actively (via PerfWatson[0], you should install it if you want
your perf problems brought to the attention of Microsoft, it should have low
overhead at runtime, only kicking in when the UI thread is already
unresponsive), but of course with a product as large and complex as VS, and
with said product being extensible, inevitably customers run into stuff we
never see internally, so we rely on getting repros/data from them to
understand what is going wrong.

[0]
[http://visualstudiogallery.msdn.microsoft.com/fa85b17d-3df2-...](http://visualstudiogallery.msdn.microsoft.com/fa85b17d-3df2-49b1-bee6-71527ffef441?SRC=Home)

~~~
redblacktree
I don't have a specific example at the moment, except that it's often
unresponsive during builds. (I guess this should be expected? Other work I do
is in interpreted languages, so there is no "build" step)

Thanks for the link. I'm happy to add it.

~~~
int_19h
Which version of VS, and what language? If you're using VS 2010 or earlier,
then both C# and VB were running the build (MSBuild and compilers both) on UI
thread, so responsiveness was as bad as you'd expect it to be with such
architecture. From VS 2012 onwards, VB builds on a background thread, and C#
builds out-of-process (which also makes it scale on multi-core systems).

~~~
voltagex_
I definitely notice the performance improvements in VS2012. I wonder how many
people reporting performance issues are also running ReSharper. JetBrains do
great work, but ReSharper (<=v7) is _very_ resource-heavy.

~~~
sultezdukes
Resharper can definitely bog things down, especially in big Razor pages.

But as you and the parent pointed out, I've also seen huge improvements in
build times with VS2012.

And with VS2013 we finally get edit-n-continue on x64.

------
jessaustin
I chuckled at: "Django (Python's Web Framework)". Someone has missed out on
years of hand-wringing about our menagerie of frameworks.

~~~
shanselman
;) The PTVS guys said they are going to add support for Flask and Bottle soon.

------
drawkbox
I primarily use Sublime, TextMate or Komodo on Mac for python dev but would
love to also use VS. I do run windows and do most dev on that under VS. Maybe
one day VS will come to Mac, I know that doesn't follow the platform mission
but would get some good traction for Visual Studio going forward and a little
fire under Xcode for C/C++ dev on Mac.

At this point both XCode and VS are pretty equal but XCode I also like and
have no problem with. Both are unique to the OS though. Both are also
extremely bloated but needed for C/C++ dev. Eclipse is also a bit cludgy. That
python to native screenshot on the site looks intruiging.

I do use MonoDevelop on Mac for Unity dev and it does support debugging but
would love to use VS on Mac one day.

All in all when I do python dev I like less in my IDE at times, just a good
autocomplete/intellisense and I usually despise integrated source control into
IDEs preferring to do it with outside tools such as terminal/cmd, sourcetree
or tortoises. SCM integration in IDEs always seems to kill performance and
gets out of sync, especially in the latest MonoDevelop (startup indexing kills
the usefulness - [http://answers.unity3d.com/questions/356129/monodevelop-
perf...](http://answers.unity3d.com/questions/356129/monodevelop-performance-
in-unity-4.html)).

~~~
stevoski
Try PyCharm. It works on Mac and Windows and is miles ahead of XCode for
Python.

~~~
drawkbox
Haven't tried it yet, might give it a try. The debugging looks cool and even
Guido seems to think it has some benefits:
[https://profiles.google.com/115212051037621986145/buzz/CGh9M...](https://profiles.google.com/115212051037621986145/buzz/CGh9MoWU53V)
\- note he mentions painful SCM integration, as usual in IDEs that just
doesn't work well. SCM support I usually turn off as it adds iteration lag
typically. Prefer the scm tools directly almost always.

~~~
euroclydon
I keep SourceTree, by the same company, running while I'm working in PyCharm,
and it picks up all the changes nicely. It has been my crutch in becoming
competent using Git.

~~~
sshconnection
PyCharm is built by JetBrains, and SourceTree by Atlassian. Both great
products, though.

------
jaegerpicker
I love Visual Studio but after having worked with python quite a lot and being
involved in the local developer community (IN NEOhio, NYC, and starting into
Southern Maine) I think I've only ever meet two python developers who used
windows as there development Os. I'm not holding my breath but if MS would
port VS to OS X/Linux it would be really cool. I don't know that a good
business case could be made for it though.

~~~
orng
On the other hand perhaps something could be done about Python so that we who
are forced to develop Python on Windows stop being second-class citizens in
the Python world?

ButI agree. VS is an awesome IDE and the more operating systems it would be
available on the better.

~~~
xradionut
You are fighting various other teams in Redmond/power users that have issues
with OSS and technology that's cross platform and not from the Mothership.
Python/Iron Python would have been a great default language for administrative
scripting , but nope, they had to reinvent the wheel with PowerShell.

(I've had MVPs yell at me for discussing data analysis with Python, even on
Windows.)

~~~
ygra
PowerShell is a very nice language in its own right, though.

------
amjith
Do people run django production sites on Windows? Not trolling, genuinely
interested.

~~~
mumphster
I currently maintain and run a big ol' Django project running on
Apache/Windows/MSSQL (and some Oracle) here (university of Arizona). It's not
that bad although myself and the other developer both use mac's so its
annoying having to RDP in to do anything in a python shell.

~~~
Ecio78
If you only use the shell, can't you use something like an SSH daemon on
Windows and ssh to it?

~~~
icebraining
Is there any decent SSH daemon on Windows? And what shell does/would it run?
cmd.exe?

~~~
alyandon
Some people dislike it but I use Cygwin when I want access to the various unix
standard tools on a Windows box (including the openssh daemon).

[http://www.cygwin.com/](http://www.cygwin.com/)

The setup.exe is both the installer and the package manager.

~~~
rbellio
I recommend trying out Mintty for Cygwin if you haven't already. I love it.

------
patja
Does anyone have experience with the free VS Shell mentioned in the article as
the foundation for putting together a free of cost installation?

How does it compare to VS Express? Why would there be two different free
Visual Studio offerings...just to keep things locked down and rule out support
for add-ins?

~~~
smortaz
overgard is correct.

Our PTVS + integrated/isolated shell basically gives you a virtual "Python
Express". However recently msft has moved away from the "Express" model to
"Scenario" models. ie, VS for Phone, VS for Desktop, VS for Web, etc. and each
includes all the tools and multiple languages you might need for that
workload. We're hoping to include PTVS into the desktop & Web scenarios in the
future.

[disclaimer: project lead]

~~~
patja
That would be cool. I've been enjoying how much I can accomplish using VS
Express for Web and Desktop. It is a little annoying having to install both of
these, but beggars can't be choosers, right?

------
jahewson
There are a lot of Python IDEs out there, some very good, such as IntelliJ
IDEA. I'd prefer to see an objective comparison.

~~~
moron4hire
It's Scott Hanselman's blog. The entire point of it is to proselytize for MS
products.

~~~
shanselman
Not really, the blog is my side gig. I talk about lots of stuff, but since I'm
in the MS dev space I lean in that direction. I work in Azure and ASP.NET as a
PM, I'm not in marketing.

------
isxek
Question: Why did the PTVS developers eventually adopt the _.sln|_.*proj file
thing that other MS languages (C#, VB) use?

As far as I can remember, there was some resistance to going through that
route before (v1.5 didn't have this, I think).

------
atilev
add in vi for VS and it's hard to use anything else:
[https://github.com/jaredpar/VsVim/](https://github.com/jaredpar/VsVim/)

------
tonyplee
Just Vi or Vim for me. Used VS, VB, Eclips years back, but now back to Vi/Vim
for embedded and server environment. Have not missed any of IDE features at
all.

~~~
winter_blue
What languages do you work with? Simple things like being able to jump to the
definition of a function with a press of a button (esp. when working with a
large unfamiliar code base) are indispensable for me.

~~~
thwest
grep is nice. its gnarly in template heavy c++, but so are all the tools.
intellisense can't reliably provide navigation among all of the possible
instantiations in your project.

(esc;qgrep -rn thing .) is faster for me than reaching for the mouse.

~~~
int_19h
>> its gnarly in template heavy c++, but so are all the tools. intellisense
can't reliably provide navigation among all of the possible instantiations in
your project.

Have you tried it in VS 2010+? You might be surprised. I've seen it correctly
handle polymorphic Boost lambdas, and that's a rather impressive feat of TMP.
Also, I've just tried the scenario that you've described (if I understand it
correctly - "Find all references" on a class template), and it does list all
the explicit instantiations in the project.

~~~
to3m
I have to second this. I hear VS>=2010 uses the compiler infrastructure to
generate the intellisense data, rather than doing it (as VS<=2008) by simple
text processing, and it's made a huge difference in terms of reliability. As
well as improved support for templates, it also does a good job of handling
code generated by macros. Newer Visual Studios might prove that the question
"OMFG what could POSSIBLY be worse than the VS2008 C++ build system?" isn't
actually rhetorical after all, but the code completion is much improved.

(On another note, Xcode. I'm normally pretty negative about Xcode, because
it's mostly awful. But I believe its code navigation and code completion is
done in a similar way - only using LLVM, of course - and that part does work
extremely well. If anything, it's actually slightly better than Visual Studio,
because its navigation shortcut is much better about giving you a popup list
of all possible reasonable destinations, e.g., if you try to go from a member
function call to its definition when that function is virtual.)

~~~
int_19h
>> I hear VS>=2010 uses the compiler infrastructure to generate the
intellisense data, rather than doing it (as VS<=2008) by simple text
processing, and it's made a huge difference in terms of reliability.

To be specific, what they did was take the EDG C++ front-end, and use it to
drive all code intelligence features (code completion etc) - see
[http://blogs.msdn.com/b/vcblog/archive/2009/05/27/rebuilding...](http://blogs.msdn.com/b/vcblog/archive/2009/05/27/rebuilding-
intellisense.aspx). That's why it can correctly handle all templates, macros
etc.

Here's a nasty trick that I love to play on unsuspecting C++ IDEs:

    
    
      template<int = sizeof(void*)> struct foo;
      
      template<> struct foo<4> {
        template<int> struct bar {};
      };
      
      template<> struct foo<8> {
        enum { bar = 0 };
      };
      
      float baz;
      
      int main() {
        foo<>::bar < 123 > baz;
      }
    

The nastiness here is that the line of code inside main() should be parsed
differently depending on pointer size on the target architecture. If it uses
foo<4>, then it is a declaration of a local variable named baz, of type
foo<4>::bar<123>. If it uses foo<8>, then it's an expression involving two
comparison operators: ((foo<>::bar < 123) > baz) - referencing the global
float baz.

Now, if you try the above in VS (2010+), you'll see that it will parse this
correctly and give you the proper type info for baz (and "Find References"
etc), which will change if you switch project configuration from "Win32" to
"x64" and back.

------
antihero
Awesome as this looks, I'm not sure it's worth giving up my entire workflow or
having to actually use Windows.

------
egeozcan
This made me remember about the "Visual Node" project[1], which is very
similar to this but for node.js. I hope it's still being actively developed.

[1]:
[https://news.ycombinator.com/item?id=5873351](https://news.ycombinator.com/item?id=5873351)

~~~
numo16
If this project isn't still in development, Microsoft does treat NodeJS as a
first class citizen in Web Matrix[1] and is definitely worth a look.

[1]:
[http://www.microsoft.com/Web/webmatrix/node.aspx](http://www.microsoft.com/Web/webmatrix/node.aspx)

~~~
egeozcan
Thanks for the suggestion. Actually, I already knew about webmatrix but it's
missing a lot of features from VS and is IIS oriented. It's been a while since
I last checked it, though. I'll have a fresh look.

------
pelemele
It's cool until you see the price tag for Visual Studio Profi/Prem/Ultimate (I
assume you can't use Python tools with Express versions). In that case I will
stick to my old copy of Visual J++...

~~~
int_19h
You can't use it with VS Express, but you can use it with VS Shell (also free)
- and we have a single-file installer that will install both Shell and PTVS
for you.

------
jiggy2011
The article mentions that Visual Studio is not required to use this, but all
of the downloads I tried from that page tell me to install Visual Studio..

Can somebody point me in the right direction?

~~~
malbs
You download either the integrated package, or the Visual Studio Shell
separately

Integrated package:

[https://pytools.codeplex.com/downloads/get/697389](https://pytools.codeplex.com/downloads/get/697389)

Isolated Shell downloads:

[http://www.microsoft.com/en-
au/download/details.aspx?id=3066...](http://www.microsoft.com/en-
au/download/details.aspx?id=30663) [http://www.microsoft.com/en-
au/download/details.aspx?id=3067...](http://www.microsoft.com/en-
au/download/details.aspx?id=30670)

good luck

~~~
jiggy2011
Great, thankyou!

------
Paul12345534
I use Pythonwin for quick and dirty stuff but I absolutely love PTVS for
anything else :) I'd never use another Python IDE after I got used to it

------
jiggy2011
Can this be made to interface well with vagrant?

------
pipboy3
is there ruby equivalent?

~~~
clone1018
As for an IDE, RubyMine.

~~~
shire
RubyMine is cool so is PyCharm.

~~~
kayoone
and PHPStorm from the same company..all their IDEs are pretty awesome!

~~~
shire
Yeah their stuff is pretty awesome, I actuall haven't tried PHPStorm how is
it? I'm learning PHP at the moment so might use it.

~~~
taternuts
If you're learning PHP I'd give it a shot, I thought it was a pretty nice IDE
for someone writing PHP for the first time

------
Aardwolf
best kept secret? How did it end up in an article here then?

~~~
xradionut
NSA whistleblower...

:)

