Monitor performance issues & errors in your code

#53: Python in Visual Studio Transcript

Recorded on Monday, Apr 4, 2016.

00:00 What's your favorite Python editor? That is one of the questions I always ask at the end of each episode. This week I want to shine a light on a fantastic answer to that question for Windows developers: Visual Studio.

00:00 On this episode, you'll meet Steve Dower a Python core developer from Microsoft's Python Tools for Visual Studio team. He's here to tell us all about it. We also cover Python on Windows, CPython, the 2016 BUILD conference and more.

00:00 This is Talk Python To Me, episode number 53, recorded April 4th 2016.

00:00 [music]

00:00 Welcome to Talk Python to Me. A weekly podcast on Python the language, the libraries, the ecosystem, and the personalities. This is your host, Michael Kennedy. Follow me on twitter where I'm @mkennedy. Keep up with the show and listen to past episodes at talkpython.fm and follow the show on twitter via @talkpython.

00:00 This episode is brought to you by Snap CI and Opbeat. Thank them for supporting the show on twitter via @snap_ci and @opbeat.

01:21 Michael: Steve, welcome to the show.

01:21 Steve: Hi Michael, thanks for having me.

01:22 Michael: Yeah. We've got some really cool stuff to talk about. I am super excited to talk about what you guys at Microsoft are up to with bringing Python into all of your major dev products, Visual Studio, Azure, those sorts of things.

01:35 Steve: Yeah, those are really exciting. We've been working on a lot of the stuff for a number of years and it's really hitting point when it's starting to come together, people making good use of it so it's very exciting.

01:44 Michael: Yeah. I bet it is. And we are going to totally dig into that. But, like always, let's get started at the beginning- tell me your story, how did you get into Python programming, that sort of things?

01:52 Steve: So, my first Python experience was- I got a holiday job at a startup company that was doing medical devices, and they had this ridiculously complicated C++ app for controlling the device that was scriptable with Python, so my job was basically writing the Python scripts to control these medical devices while we were testing them, and then after that, I started grad school, and one of my supervisors said, "Hey you should pick up all of this code that I've done previously and use some of that" and I kind of looked at him and said, "Is this going to help with your work," and he was like, "Yeah, of course it is." But that was all in Python, so at that point I was neck deep in it and have not yet seen a reason to come out, so...

02:36 Michael: Yeah, it's a very nice environment, isn't it?

02:39 Steve: It's great. It's just so flexible and it has so much power that users don't actually have to see in the code that they write. One of my favorite thing is writing really complex libraries that look incredibly simple to use and Python's magic, metaclasses, decorators, make that just really nice and do a lot of stuff that people never actually see or have to know about.

03:01 Michael: So you'd say that it's kind of a different experience and if I was like writing C++ with templates and multiple inheritance and all that kind of stuff, right?

03:06 Steve: C++, I actually put C++ in the same category, I quite like writing templates and C++, yeah, but it's definitely a different category form Java or CSharp where you just don't have the ability to hide so much of the implementation from what users get to see in the code. So the interface is a bit more restricted in those languages, and you use what you get.

03:29 Michael: Yeah, that's for sure. You work in Microsoft, you said you've been there like 4 years or so, is that right?

03:33 Steve: Yes, 4 years, which means following on usual tradition I need to provide 4 pounds of candy for everyone, which I am sure my colleague, my way conscious colleagues are not looking for to, but I'll make them indulge.

03:46 Michael: There you go. That would probably be easier to do if your job anniversary was around Halloween. The stores are stocked with candy.

03:55 Steve: Or just after and get all the discount and stuff.

03:58 Michael: Exactly, that would be the best time. So, how did you get there?

04:01 Steve: I actually got there through contributing the Python tools at Visual Studio that I am working on now, that was one of the open source projects to be done at Microsoft, it was one of the very first to accept external contributions and so I was contributing. And that led to an offer of internship, and so they brought me up from Australia for three months, and the nicest three months of the year in Seattle, Jun, July, August, so they brought me for those three months, and got to the end and said, "What do you think, do you want to stay?" And I'm like, "It was beautiful weather, sunny, it wasn't too hot, this sounds great, yeah, I'll come back." And so I was contributing to an open source project that turned into a full time job and a career, writing open source projects at Microsoft.

04:43 Michael: Yeah, that's really awesome! I think those months- I spent a lot of my time in Portland, and we have basically the same weather, those are like the marketing months, people fall in love with the city and the surroundings and then, the season of rain comes for the next six months. [laugh]

05:00 Steve: Yeah, it's a complete bait-and-switch.

05:02 Michael: It is. But you know what's really good is you are not driven to go outside, you are not pulled to go out to nice weather, you can just focus, do some programming for six months and come back out when the sun shines.

05:12 Steve: Yeah, and it's almost like they deliberately put the offices somewhere where people are going to stay in the office for longer.

05:17 Michael: Yes, very nice. So that's great, I suspect back in that time frame, not so many people were hired at Microsoft to write open source.

05:26 Steve: I don't honestly know how many people were doing it, at that time, there were no many, so my team worked really hard to get the Visual Studio support for Python to be written as an open source project and many meetings with lawyers. These days to release something under the MIT license or the Apache license is really easy, but at that point, they spent months dealing with lawyers, explaining what everything meant, letting the lawyers do the every search and find their backgrounds, and just figure out is it safe for us to be releasing this stuff under this license, what's a risk, what can go wrong, and eventually, the team just pushed hard enough to make it happen. And without that, there was no open source coming out of Microsoft for the largest part.

06:10 Michael: Yeah, that's really cool, and back then, that was such new idea at least in that space, obviously, open source had been alive and thriving, but large corporations doing major open source, outside of a few places like Red Hat that was pretty rare, so it's cool that you kind of got to be a part of that, that seed there, and I think in the early days at Microsoft a lot of their attempts to do open source came in what I consider like a source open rather than open source, which means you may see the source, but there is not like pull request and take backs and this stuff like wasn't really there in the early days for a lot of the projects, like I am thinking of a speed.net for example.

06:50 Steve: Yeah, absolutely, and some of the licensing that we did, again, it's all about managing risk and clearly at some point there were a couple of lawyers, that the entire legal department decided that the best way to manage that risk would be to create licenses that had exactly the clauses that we were concerned about, and so we had the Microsoft public license, Microsoft recipical license, were invented and used for a while and fundamentally, I don't think there is anything wrong with those licenses, apart from the fact that they weren't the ones being used but he community at that point. And they never really became common use in the community, so people who were used to saying oh, this is Apache, this is MIT, this is BSD, I know what these mean, these are familiar, suddenly, you see an unfamiliar license and without being a lawyer, going through and figuring out that it's the same is it's not a difficult task, but it's legal work. I think people would just seeing those licenses going, "I don't really trust this, I don't know this, I don't understand this", much the same as the people who created those licenses would probably looking at the other ones going, "we don't understand these, we don't trust these, what if, what if, what if".

08:00 Michael: Yeah, this is so different than my corporate suffer JULA agreement I only have this MIT thing, so bizare.

08:07 Steve: Yeah, and, there is basically no language shed between the two, if you go and actually read some of the corporate URLs that nobody spends that much time looking over but and I am sure there is some very disappointed lawyers who put a lot of effort into writing those that most people don't actually read them.

08:24 Micahel: Yeah, that's too bad. I guess probably in the early days, those types of licenses felt just like, oh, here is a company trying to do open source, but they obviously don't fit in, they just look different. So, they must not really be doing it. But, you guys have adopted the more main stream stuff these days, you've moved a lot of your source code to GitHub, you've got more standard licenses things like that, right?

08:45 Steve: Yeah. And at this point, as I said, for teams that want to do open source work within Microsoft, basically, the only choice of license is MIT, these days. Apache too still gets some use, and I think there is a slight movement away from that, just in terms of what I am saying happened at the company, it's all about where are people actually doing this, how are they actually doing it, and we've also had sort of a generation of engineers coming in who are familiar with all this, so basically, everyone working at the company that is under 30 has used GitHub for their own projects, they've been using like proper open source, they've been releasing their own code under open source for years already, and so they come in, suddenly you've got this entire band of junior engineers who know how it should be done, know how everyone else expects it to be done and is willing to push and make it happen. So over time, we have definitely moved to a much better place as far as having- as far as I don't like saying joining the open source community, because it sounds like it's really forced, but we've definitely got more products that are considered genuinely open source projects at this point.

09:51 Michael: Yeah, it definitely embracing the concept in the community of open source more, so that's cool. So let's talk about Visual Studio and specifically the Python support that you guys built. Now, I have a pretty wide range of listeners spec, most of them know what Visual Studio is, band the history there, but can you give us like the 30 second pitch on what is Visual Studio, where did it come form and why is it special that has Python support now.

10:15 Steve: I suspect Visual Studio is probably older than me in a lot of ways. It's very old project that is basically Microsoft's development platform, so developers who need access to editor's tools, debuggers, and all of the things that come with the building and managing and releasing software typically find themselves inside Visual Studio. I first started using it as Visual Basic 4 which was long time ago and it's grown out of that I don't have the full history in my mind, I mean at that point I was hobbyst and not an employee. But, these days Visual Studio is very much the development platform, it's the integrated environment, that has all of the editors, all of the tools, all the languages that Microsoft supports development in, go through Visual Studio, all of platforms that you may want to build things for, deploy things to, so everything form xbox through the foreign which includes all foreign OSs at this point. You'll go through Visual Studio for building, debugging, deploying, testing, it really is the home for Microsoft developers.Yes, so bringing support to that, is something that our team has been really keen to do for a long time, just because it's already the home for so many developers, and so people who are using C++ or people who are using Javascript and may want an alternative for another language have historically been switching out to other editors and there is no need for that, I mean Visual Studio has great support for so many languages that having Python in there as well, is something that we've always been really keen to have, so we've been working on that for years and at this point it's right up with the other languages which is great to say.

12:00 Michael: Yeah, that's really great to see and we don't often just work in one language anymore, right, like if you are going to build a web app you are probably doing some TSQL you are doing Python, obviously if you are doing in Python, you will be doing some CSS, HTML, some Javascript, and the fact that Visual Studio is really good at all of those things and now Python, is well, that's really cool, because it brings them all together really, in like in one place, you don't have to jump around, like you said. So, can you maybe contrast like the development experience with say like Sublime or Emacs, why would someone who is like "I love Sublime, it's super fast, it's light weight, it's free"- can you contrast that with like Visual Studio, and how much does Visual Studio cost to get going with?

12:51 Steve: Depending on what you are planning on doing with it, Visual Studio is probably free. Visual Studio community edition was released two years ago, and that's still part of the current release, is the free version, and that's available if you're basically not a huge company or you are working on open source software you can freely use community edition which has all of the features of the professional edition, it doesn't have the enterprise level features but that's mostly I believe application life cycle management stuff that some people absolutely love and require it, and we use it a lot internally at Microsoft, it's not critical for small projects and certainly if you are using GitHub or some form of public issue tracker it's not actually that valuable for you. But the free version is widely available and that includes all functionality and as everything from Python support, NoJs support, and even as we just announced the other week that's going to include Xamarin for all the cross platform work that people want to do this.

13:56 Michael: Yes, Xamarin is interesting story, I don't want to go down that rabbit hole, but you know, just so for people who maybe don't know, Microsoft purchased Xamarin about a month ago and Xamaron is basically a development environment for taking CSharp code and building cross platform apps that feel native, right? Like for example, I learn Build, watching some of the Build videos, doing some research on this stuff that Slack builds their mobile apps with Xamarin, that's pretty cool.

13:56 [music]

13:56 This episode is brought to you by SnapCI, the only hosted, cloud based continuous integration and delivery solution that offers the multi stage pipelines as a built in feature.

13:56 SnapCI is built to follow best practices like automated build, testing before integration, and it provides high visibility into who is doing what. Just connect Snap to your GitHub repo and it automatically builds the first pipeline for you, it's simple enough for those who are new to continuous integration, yet powerful enough to run dozens of parallel pipelines. More reliable and frequent releases, that's Snap.

13:56 For a free, no obligation 30 day trial just go to snap.ci/talkpython.

13:56 [music]

15:31 Steve: Yeah, no it is really nice to have like getting back to the right ones run any web, but it's a genuine run in the place where you are and not sort of the old completely lock down virtual machine run anyway that we had in the early days of Java.

15:47 Michael: Yeah, we open an about box and it looked clearly foreign.

15:50 Steve: Yeah, exactly.

15:52 Michael: You open like a file browser and it was obviously not a part of the os or something like that, right?

15:56 Steve: Yep. Compared to something like Sublime that is sort of really light weight Visual Studio you are going to find a more featureful experience, so I know a lot of people love Sublime because it opens quickly, Visual Studio can open quickly, quite often, and certainly always working on improving that, but the big difference is once you are in, Visual Studio has much better IntelliSense for every language that it supports, then you will find in light weight text editor, and even a lot of the plugins for Emacs and VI don't actually reach the same level of intelligence about your code that we have in Visual Studio, so things like understanding decorators, recognizing what types have gone into 16:37 and then when you expand that out later we still know those types, things like what items have been added to our list so when you itterate over that list later we can say yeah, we know it's one of these types because these were all the things that you've put into the list everywhere else in your code for this particular list.

16:54 Michael: Right, so you get like IntelliSense on item to the list in your foreign loops for example, right?

16:58 Steve: Yeah. Which demoes really nicely most of the time, but it is certainly a feature that's very unique to the integrated development environments the bigger heavier weight tools that I guess the current generation of advanced text editors were saying like Sublime, like Atom, like Notepad++ just don't have that same level of intelligence about the code.

17:20 Michael: I think that sums it up pretty well, and people who listen to this show a lot know that I kind of come down on preferring the heavy weight IDE stuff that really helps once you get started with large projects and understanding code, but I know that not everyone is that way so it's interesting to look at the both sides.

17:36 Steve: Yeah, and it's definitely interesting to see the difference between different communities of people when it comes to this. Because I find so at Build last week talking to largely Microsoft audience, everybody knows Visual Studio, everyone loves it, and they don't really know Python that well, but that means that when you get up and show IntelliSense they are just not impressed. Because they are used to Visual Studio and they are like, "well, you are in Visual Studio of course you get IntelliSense, why are you showing me this?" Whereas, when you go to the Python audience, and even people who will flat out say "I don't want to use an integrated environment, it's too heavy weight, it doesn't add any features" and then you show then that you can go to any variable and hit f12 and see everywhere that's it's been assigned, or go to the very first place it was defined you can overwrite or monkey patch functions and see all the places where those would change and where they all came from, and suddenly they go, "Oh wow, this is amazing, maybe I do want the heavy weight environment if it has this kind of magic functionality."

18:34 Michael: That's right, maybe it's worth waiting 3 seconds for it to start or whatever, because you will be in front of it the whole day. So let's talk about some of the features, before we do, one thing that you mentioned in some of your conversations in Build conference, was sort of about IronPython and Python 2 and Python 3 support specifically, CPython. Some people listening might be thinking, well this is Microsoft, it's Windows, it's Iron Python, which is the Python that runs on top of the .Net CLR.

19:01 Steve: Yes, so IronPython was a project, started at Microsoft, I don't remember exactly when possibly as long as ten years ago at this point, when they were building the common language runtime there was a small team that decided we should build a dynamic language runtime on top of this as well, so effectively using the .Net platform to do it dynamic languages and as part of that, they built IronPython and IronRuby to use that runtime as you need to make sure that it's actually valid by doing something useful with it. And then when that project eventually was not advancing any further in that form and some pieces were taken and used for other things so people familiar with the dynamic keyword in CSharp will probably recognize that that came out of that work. But IronPython and IronRuby were effectively pushed out to the community around about 2009/ 2010, and since then, Iron Python has been maintained externally, Microsoft has nothing official to do with it anymore, we do occasionally contribute to it, but it is Python on top of .Net and a lot of people still use it, it gets a lot of love, especially from people who have sort of CSharp or FSharp assembly that they want to use from Python or they want to test from Python, because it's so natural to just load those up with an import statement and call into it. But there is a big assumption that being Microsoft that's all we care about, and that's absolutely not the case at this stage and hasn't been for six years. When that project was released and we started on the Visual Studio support, it was really clear the 99% of Python developers were using CPython, and there was just no way that we could cut those people out and say well, you've all got to switch to .Net to use this, that would have been just ridiculous, so we didn't do it.

20:48 Michael: Yeah, and the guys with things like NumPy they were like, you know, I kind of like this library, I'd like to see integration with this package, i don't want to just do some .Net thing, obviously, right?

20:59 Steve: Yeah. And, NumPy is hard enough to build on Windows already that we wouldn't want to be forcing people to have to build it as part of Iron Python, though we did try that for a while that was a project to get that working that eventually just ran into too many issues, but yeah, CPython is sort of the main star of the show, for us, so the Visual Studio support extends from CPython 2.5 through 3.5, with every version in between, and 32 bit, 64 bit and every and everything from debugging, profiling, intellisense, we have all the content sensitive keyword, like async, we handle all the future imports for CPython properly, and all the other interpreters are supported as well, and frankly, you know, they tend to come off a bit like a second thought compared to CPython, we are very much focused on the same area that the entire Python community is focused on, so PyPy, Jython, IronPython, we test, we use a bit, but CPython gets the bulk of the work.

22:02 Michael: Right, I kind of feel like the entire community is just going to use CPython unless there is some huge pressure from a performance problem or some other type of thing that forces them to go and find some other interpreter runtime like PyPy which is really cool but it's just not the standard so you've got to have a really good reason to do that, right?

22:21 Steve: Yeah. And frankly I am a little disappointed the Jython didn't get a nice big boost from minecraft integration, I was really hoping that was going that was going to push it along way, but that doesn't seem to have happened, I know a few people have done that, but that could have been a lot of fun.

22:37 Michael: Yeah. Too bad. let's talk about some of the project types, and types of apps you can build with Visual Studio Python support. So you guys have web apps, right?

22:48 Steve: Yes. So a project in Visual Studio for those who don't use it is essentially just a collection of files, you can think of it as these are the files that all relate to this one project, it's roughly equivalent to these that are ones that I check into source control, all the things that I may want to add within Visual Studio, but a project also includes things like launch options, debugging options, and so there is a few sort of categories of those that we like to start with, so web projects are quite often have different launch options, so rather than just type in Python name of the script, you do Python/mbottle name of the script, or Python manage.py run server, to get it going, so they have different launch options, so we provide some projects that pre configure those effectively so that when you go and hit F5 to start running it's already setup for running that web project but the project itself is not actually that constraining, and it's quite easy to configure a regular project to be a Python project and we've actually got some future work coming which I think will talk about future work in a bit that will just get rid of projects completely.

23:53 Michael: Oh how interesting. Ok, well that sounds really cool. So, if I have like a Flask app, and it's got all of its templates, does it understand, does a Visual Studio understand like the Ginger 2 or Cameleon templates?

24:07 Steve: So we don't have Ginger 2 yet, a while back we invested in Django templates, and have that, so if you are using Django and using the Django template syntax, this is before they offer Ginger 2 as an option, then you will get IntelliSense withing the template file, you will be out the debug, you can set a break point in the template and it will stop, and you can step through your template as it's been generated on your local machine.

24:31 Michael: Yeah, the debugging, the templates, that's pretty awesome, because sometimes when template binding goes wrong, you are just like, "why is this not working, it's really hard to understand" like when it's handed off to the templating engine, like what's going on anymore, so that's pretty cool.

24:44 Steve: Yeah, and definitely when things go wrong you don't always get the nicest stack trace out of it, so being able to stop execution just before something gets rendered incorrectly, and inspect and see what is going on is really helpful.

24:56 Michael: Yeah, a lot f times it's kind of like there was something wrong with your template.

24:58 Steve: Yeah.

24:59 Micheal: Or your data going to the template, sorry, because it's just a call stack of like the template parsing so, that doesn't help.

25:07 Steve: Yeah, So generic Ginger 2 support is on our wish list of things we'd love to do, we briefly investigated updating the stuff we have for Django, to support Ginger, and it's not quite feasible yet, original style Django templates were mostly handling with Regexus because they have a more restricted format, Ginger 2 you can't do that, Ginger we need like a full HTML/Ginger parser to be able to figure out how it all works, so that is on our wish list, we'd like to have it and we just haven't had chance to get to it yet because it turns out running a parser is a big task.

25:43 Michael: Yeah, I am sure that it is. So if somebody is out there listening they are like I could totally write that parser, do you guys take contributions and stuff?

25:51 Steve: Absolutely. GitHub.com/microsoft/ptvs that's Python tools for Visual Studio, and yeah, come let us know that you are interested, we are happy to help you out, and we'll accept pull request, we've already accepted one for a next big release, so people who are looking for brace completion, that was contributed by an external person who basically just came along said, "I really want this, I am willing to do it, here is the code, what do you think?"

26:16 Michael: Oh lovely.

26:16 [music]

26:16 This episode is brought to you by Opbeat. Opbeat is application monitoring for developers, it's performance monitoring, error logging, release tracking, and workflow in one simple product. Opbeat is integrated with your codebase and makes monitoring and debugging of your production apps much faster and your code better.

26:16 Opbeat is free for an unlimited number of users and starting today, December 1st Opbeat is announcing that their Flask support is graduating from beta to a full commercial product. Visit opbeat.com/flask to get started today.

26:16 [music]

27:09 Michael: So, one thing that I saw that you guys can do that I think is sort of special because the deep relationship with C++ and C and Visual Studio like the my first experience with the Visual Studio was with Visual C++ 1.52 back in like 1994 or something, so it's been C++ capable for quite a while, and one of the things you can do is you can like mix mode, you call that mix mode debugging, right, that sounded pretty cool, can you talk about that?

27:34 Steve: Yes. So, it's actually one of our most popular features, it's unique to Visual Studio, we are not aware of any other development environment out there that can do this, though gdb has some extensions that get kind of close. What it essentially is is when you have Python code calling into C module, so one that you've written and build yourself, when we have the debugging information, we can give you a debugging view of both the Python and the C code simultaneously. So, you can set a break point in the C code, you can set break points in the Python code, you can inspect variables in each one and see sort of from the C code, oh, I've got a Py object star, if i hover over it and have a look it will show me what it would look like as a Python object, whether you know, a list of items or a 28:17 pull or a dictionary, and step between the two different worlds and so you end up with this cold stack that goes Python Python Python C C C CPython Python Python - which is, amazingly helpful when you are trying to debug native modules, it's actually something that I had to do a lot when I first started and we didn't have this feature, so I know how incredibly painful ti is to do without having this sort of layer on top that shows you all the actual Python values that you would be missing otherwise.

28:47 Michael: That is super helpful, so I guess anyone out there listening who is writing some sort of C extension and wants some help debugging it, try the free Visual Studio version with the Python tools included that would be awesome. So, do you want to talk about some of the other project types? One of the things that seems like Microsoft is up to these days last three of four years, ever since Satya Nadella has taken over I guess, is you guys seem to be all in on Azure, and so you could actually have support for Python and sort of deploying straight out of Visual Studio into like a web app running on Azure, right?

29:22 Steve: Yeah, so Azure web apps kind of the highest level most managed platform I guess for deploying websites, it's really quick to just push out the code for a site to end, now you have an active websites, there is no setting up machines, there is no installing web servers or doing some machine level configuration, it is within a minute of saying I would like a website, you've got a website which is really cool. And so the support that we have inside Visual Studio for that, just brings that down, it's just bringing the click countdown, because you can do all of this through ftp, or you can do it through via a git repository, and then there is sort of the one click I have my files here on my machine, I want them on that machine, just go and do it and we'll go off and do it.

30:11 Michael: I really like the websites that you guys have at Azure, like if I need a little small website that I just spin up really quick, my first thought often is to just go to Azure, because there is nothing to set up, and you can have up to 10 sites, I think for free, like 100% free, forever, that's pretty awesome.

30:26 Steve: Yeah, I think ten is a limit and if you want to try it without even signing up then you can go to I think it's try.azurewebsites.net, and we'll give you a free site for an hour without any signup, no credit cards or anything at all, we'll just give you a site, we'll give you a git repository, and so you can push directly to the site and have a website running and there is a whole lot of templates in there if you want to start form a Django, or Bottle or a Flask site, or if you are interested in doing it in PHP or NoJs we have like all of the languages are supported for websites and so that try.azurewebsites.net is just a really quick way to get a website going and see whether it does what you wanted to.

31:07 Michael: Another one that I saw that I have no experience with, you will have to tell me a little bit about it, is when I was playing with the Python projects, I saw that you have a windows internet of things core, maybe windows core 31:19 as a Python project type, what's that?

31:22 Steve: There's a team at Microsoft at the moment, that's been working on what is known as Windows IOT core, it's basically a version of Windows that is really stripped down, it's still sort the latest builds of Windows but there is a lot of unnecessary thing removed and it's really designed to be run on like Raspberry Pi 2 or sort of about that scale devices, for sort of high level internet of things type tasks, so it's not a little tiny micro controller device that's just got a sensor attached to, but something bigger where maybe you've got a running process, that's going to pull down a whole lot of data of the internet, do some processing, display in on unattached like screen or device of some sort and that platform has a slightly different app deployment model then on like the Raspberry Pi OS or some of the other IOT things. So it is running Windows, one of the big benefits of that is a security you get out of it, and in terms of you can't just run unsigned code on it, you can't jump outside of the sandbox that the code is running within, and it has a lot of those benefits.

32:24 And what that means is that you need to go through a couple of extra steps to deploy code to it in the first place. So that template is actually very different from all the other templates we have but it is a good starting point for IOT, you jump into that and you get a special version of Python that we had to rebuild, so the Python 3.5 rebuilt to run on IOT core, I believe something like 95% of the functionality is dead, there is a few features that had to be removed because they would not work within the sandboxes provided, but within that, you can set up a background servers, it can do network access, it can do processing, and all of that will then be easily deployed to raspberry Pi 2 or any device, I figure out the other ones that it will run on, but anything that windows IOT code will run on, can run those Python applications and 33:13 in Visual Studio, you have sort of that one click deploy and run, you can F5 to deploy and debug, and we'll use remote debug to attach to it, and you get the full Visual Studio experience of stepping through, inspecting variables awhile running on a little tiny device.

33:29 Michael: That sounds awesome. I should check that out.

33:31 Steve: Yeah, and not to exclude the other ones, if you are working on like on original Raspberry Pi or a different OS, then Visual Studio has remote debugging for Python, so it's a little module that you can put with your code on any platform on clusters of Raspberry Pi, and use Visual Studio to do that debugging, by connecting to it from 33:51 machine.

33:52 Michael: That I haven't got to play with but it sounds really handy. Awesome, can you give us a glimpse of maybe something that is coming, that people don't know about, like a feature that is under developing that is pretty cool?

34:01 Steve: Basically everything that we do, that we are actually doing, is going to show up on our GitHub site so if people go and look at the commits there you can see what's definitely coming some time soon. There is a lot of things that we talk about, that don't always make it past the talking stage, so it's kind of hard to say from the huge list of stuff we say, yeah, we'd love to do this, we'd love to do this, which ones will make it to the stage of we are actually doing it. One thing that is getting very close to that second step, and is support for Visual Studio code, so people who may not be familiar with that recently, in fact about a year ago, Microsoft made the first release of Visual Studio code which is a cross platform version of Visual Studio, it's lighter weight, it doesn't have a lot of the advanced functionality yet, but it's much more compared to something like Sublime text in terms of I have a directory of code here, I just need to jump around in it a bit, I still want good IntelliSense, I still want the ability to navigate based of code semantics rather than simple searching, I need Git integration, I want F5 to debug, and we are at the point where 99% certain that we'll be committing to like really beef up Python support that it has basic support for a lot of languages, including Python, but there is not yet any debugging, there is very limited or no IntelliSense and launching is not quite there yet, so there is a range of things to work on, there is currently a community extension that is doing it, and we are thrilled to see that the community has said, hey we care enough about Python to make this happen regardless.

35:33 Michael: Yeah, that's great, do you know the name of the extension so people can search for it or I could link to it?

35:37 Steve: The extension is Python, so if you just ext install Python, from within Visual Studio code you will get it, it will make it difficult for us if we put out another Python extension because we'll have to pick a different name-

35:50 Michael: Oh yeah, they really grabbed the main name, didn't they?

35:52 Yeah, they went and took it, so there is always a possibility that we'll get in touch with the guy who has created and say, hey, you've already got users, everyone already loves this one can we contribute to it, and then maybe we don't end up with an official Microsoft one but we really beef up the community own and driven one already with all of the stuff that we've got from Visual Studio proper, we'll try and bring that over to Visual Studio code and get that out there. So, not quite sure how that looks right now and not quite sure when it's going to be available, but it's definitely something that is coming and so there will be cross platform Visual Studio code Python support coming soon.

36:30 Michael: Yeah, that's awesome. It's nice to see the Visual Studio code coming along, and with the whole .Net code stuff and I talked to Bret Cannon who was on the show #49 about some of the Pyjion work, that you guys are doing, involving.net core, and cross platform, so all those things are coming together really nicely. But let's take it back to Windows, for just a second- so, as somebody who teaches Python, I want to say thank you for building the new Windows installer for CPython, oh my god, that has been such a nightmare to try to- people come to class, they've got some crappy old laptop, you know it doesn't have Python on it, and they want to get started and they forgot to check the little box and there is so many little gotchas and you recently updated that in a pretty major way, right?

37:23 Steve: Yeah, so PyCon last year, I think, or it might have been a year before, I think 2014, the person who was responsible for producing the builds of CPython for Windows effectively resigned and said, "I've got other things, I need to step away for a bit so if someone else wants to take over then they are more than welcome to" And, thinking it wouldn't be that much work I put my hand up, which turned out to be a silly thing to do, but that's what I did and so since then I've been largely responsible for a lot of Python on Windows. One of the things that I've been really keen to do for a long time, and was kind of going to contribute it anyway was rewrite the installer. And, I mean, frankly, I am still not entirely happy with where it is at, but it's not something which you can change dramatically too often.

38:23 Michael: I can tell you it is a much nicer experience than it has been, so I can definitely say that so people who have tried like setup Python on Windows before and really, oh, here it goes this thing, that almost works, it's a lot nicer, so it\s great.

38:42 Steve: Yeah, and I did achieve two of the big things that I wanted to do which was moving the default installation directory, into someway more secure, because historically, if you put Python in the route directory of your system drive, anyone on that machine can write to it, and that then means that someone who is not an administrative user can install whatever package they want and then if someone who isn't admin runs that Python at all, they got to run that code that's been installed by someone who shouldn't have privileges to install it for them, so that was always a security concern for a lot of Windows users, a lot of corporations and so by moving it either into program files or into the users install directory, that mitigates that attack factor which is a real big improvement for a lot of people. The other thing is a proper per user install. So, previously if you installed Python you could say install it just for me, but you still had to be an administrator to actually install it, so one of the big changes that I made in that installer was so if you choose that, and then you choose not to install the launcher for all users, then you don't need to be an admin at all, and we'll just go ahead and install Python without ever asking you to elevate, so it's great for students who may not have full control of their machine, people working at companies where the machines are locked down and they are not allowed to make changes to it, you can still install Python 3.5 on those machines because we don't require to actually make changes to the machine, we just put all of Python into a directory that you have full access to already.

40:16 Michael: Yeah, I've run into that problem more than once that people even though they are professional developers at a company, they are still not given enough control of their machines, to make system changes which is kind of ridiculous, but it's great that that's all there. So, very cool. Let's talk about Build for a little bit, so this is kind of like Microsoft's major developer conference, and you were there, I saw you giving some talks on Python, you were kind of spreading the good word of Python, say, Look I know a lot of you guys here that guys doing C++, you guys are all doing .Net, but you know, maybe you should consider Python- can you maybe give us your impressions of how like what you guys announce this year, and then sort of how did your session go?

41:04 Steve: Yeah. So, Build always have a lot of exciting announcements and even for employees, we don't know a lot of the stuff that is going to be announced there so we are all watching the keynotes the same as everyone else, and seeing all the exciting stuff coming out, yeah, I mean, I am still waiting for the day when we get to make some big Python announcements from the keynote stage, but that's probably a couple of years away still at this point, but I am hoping for that. But yeah, there is definitely so much coming out, I love the idea of conversation bots, I really like that idea of making so many of these interactions more natural. I definitely feel like we've gone from- ten years ago you would call up a hotel to book, no one does that anymore, you've got websites, or you go to a third party website that will do the booking for you, and it's gotten very impersonal and I don't actually say that undoing completely, but having the sort of conversational option to do something like that where it can use context because it knows about you, having I guess an interactive dialog to achieve a task, as opposed to where you know, step 1, step 2, step 3 wizard kind of format feels like a great step into a really exciting future.

42:18 Michael: Yeah, that's pretty cool. And just to kind of step back for listeners who maybe didn't see the announcements or anything, you guys announced this thing called "a bot framework" did I get that right?

42:29 Steve: Yeah. Bot framework, which we announced and said this is for CSharp, and NoJs bots and so of course the first thing I did was went off to write a button Python.

42:36 Michael: Did it work?

42:38 Steve: It did, it worked great. The documentation is not quite thorough enough to make that easy for people to do, because kind of the first step is install this library or install this library, and until we have a Python version of that library which is something that I am really keen to do now, it's not quite trivial to get it up and going, but even without that, I managed to get a Bot going that you can chat with through the framework and so then the nice thing about fitting into the framework is you then get all the connectors, so it's instructions are provided for connecting that Bot up through Telegram, through Twitter, through Twilio, through so many of these services, that if you want to interact with it by email, or by phone call, sms, you could just do that, and so that's a really cool thing about that framework, it's you write a Bot once and then you can reference it from all of these services that support Bots in some form.

43:29 Michael: Yeah, it looks really cool, and for the data scientist out there that are listening, the back end stuff that you guys are ding with like machine learning and natural language processing, there is a lot of really cool sort of semantic understanding of written text and stuff. So, I think that was one of the really interesting ones. You guys did a lot of open source announcements, so we talked about Microsoft becoming more open source and this was absolutely evident there, that was super cool to see but one that surprised me, I did not see coming at all was Ubuntu on Windows, tell me what that is?

44:01 Steve: I don't think anyone saw that one coming. I wouldn't have been surprised if the CEO, whenever they went and told Satya hey we are going to announce this at 44:09 Build if he wasn't completely shocked out. It's really cool, I had a chat with those guys and it really is such a nice thin layer on top of the Windows APIs that you'd never see, so it's not like Segwin 44:23 where you have a different set of libraries to boat44:26 against, it's a kernel so everything is already built for Ubuntu, and it is literally, we just copy the binaries over and every time they go to call into the kernel, that gets in decepted 44:37 and rewritten into the Windows kernel code, but it's completely transparent so you don’t have to reboot anything, you don't have to change references, and so when you get bash you just get into and start calling stuff, it's all the exact same elf binary as you would have on like a machine that has like Linux all the way through instead of being this layer on top of Windows. And the thing that really blew me away, is I didn't test this but I saw the blog post, the performance is apparently right up there with sort of a native Linux machine which is incredible.

45:09 Michael: That's really awesome. So people who are love their Linux tools, which a lot of python developers do, like this is coming to Windows, basically, what's the timeline, did you catch that?

45:20 Steve: No, I didn't catch the timeline, but I understand it's in the current preview releases, so if you are part of the Windows insider program, then you should either have a bot with it or you will soon be getting a bot that will let you try it out.

45:35 Michael: I got the sense that it was coming with what you guys call the anniversary update of Windows 10?

45:38 Steve: Yeah, I expect that one to come out, but certainly there are early builds available, I've used one but I get access to the daily builds. But the insider builds are not that far behind, they are typically only like 3 to 4 days in my experience behind what we have access to as employees, so there should one out there at this point already. Though I haven't checked, so I could be wrong, but it's very cool.

45:58 Michael: Yeah, I'll be sure to link to that in the show notes as well. Steve, we just have a few more minutes, so it's a time for a couple of closing questions- this one could be a softball for you- what's your favorite Python editor?

46:11 Steve: Visual Studio.

46:15 Michael: That's awesome.

46:14 Steve: Isn't that the answer everyone gives?

46:15 Michael: Yeah, well I am trying to spread the word. I think it's great what you guys are doing there, so congratulations on that. And, I always ask- there is so many packages on PyPi, at least 75 000 last time I checked the number. There has got to be ones you use that maybe people don't know about, like you should check this out, it's awesome. What ones are yours that come to mind?

46:39 Steve: Oh well, so leaving out the ones that I have written myself, because that seems a little unfair, though I do like the project oxford library, which does text to speech and speech recognition and natural language understanding, using what is now called the 46:54 intelligence that's a fun little demo that I wrote, probably and certainly if you ask my colleagues, I talk about Requests all the time. And that's largely because I keep seeing code that's using HTTP lib and my answer is always just use Requests, stop using anything that isn't Requests, so... That's almost certainly my favorite library. And if you have used HTTP lib, stop using it and use Requests and you will see why.

47:19 Michael: Ok, final call to action? How do people get started with this whole thing you guys built?

47:22 Steve: So, ak.ms/python, is our sort of short link, and that will get you to right now it gets you to the Visual Studio page about the Python support, depending on when you come back and listen to this podcast, it maybe pointing somewhere else but that's always going to point to the best landing page for whatever Python stuff is going on at Microsoft. Probably the second one, is ak.ms/pythonblog which is our team's blog so we are posting there once a week, on everything from what are we doing at Microsoft with Python, what is going on in the community, what's some ways of improving your coding style and that's where you will get the latest news about whatever Python stuff is going on at Microsoft.

48:05 Michael: Yeah, I set it up the other day, just a few days ago on my fresh new version of Windows 10 and it was no problem, nice and easy, just install Visual Studio, install the Python tools and find a new project, pick your Python flavor and go. It's very nice. I would also like to add one more thing- people out there listening- you should check out the build keynotes, I'll link to them in the show notes, there are some really different stuff happening at Microsoft then 5, 10 years ago.

48:33 Steve: Yeah. It's very exciting. I love the way it really getting innovating again.

48:41 Michael: Yeah, congrats on all the stuff that you guys are doing, Steve, it was great to have you on the show, thanks for given us the inside look on what you guys are up to.

48:47 Steve: Thanks Michael.

48:47 This has been another episode of Talk Python To Me.

48:47 Today's guest was Steve Dower and this episode has been sponsored by SnapCI and Opbeat. Thank you guys for supporting the show!

48:47 Snap CI is modern continuous integration and delivery. Build, test, and deploy your code directly from github, all in your browser with debugging, docker, and parallelism included. Try them for free at snap.ci/talkpython

48:47 Opbeat is mission control for your Python web applications. Keep an eye on errors, performance, profiling, and more in your Django, Flask, and even Pyramid web apps. Tell them thanks for supporting the show on twitter where they are @opbeat.

48:47 I use both of these products on all the Talk Python web properties, and you should check them out too.

48:47 Are you or a colleague trying to learn Python? Have you tried boring books and videos that just cover the topic point-by-point? Check out my onlne course Python Jumpstart by Building 10 Apps at https://training.talkpython.fm/.

48:47 You can find the links from the show at talkpython.fm/episodes/show/53

48:47 Be sure to subscribe to the show. Open your favorite podcatcher and search for Python. We should be right at the top. You can also find the iTunes and direct RSS feeds in the footer on the website.

48:47 Our theme music is Developers Developers Developers by Cory Smith, who goes by Smixx. You can hear the entire song on talkpython.fm.

48:47 This is your host, Michael Kennedy. Thanks for listening!

48:47 Smixx, take us out of here.

Back to show page
Talk Python's Mastodon Michael Kennedy's Mastodon