Learn Python with Talk Python's 270 hours of courses

Python in Visual Studio

Episode #53, published Wed, Apr 6, 2016, recorded Mon, Apr 4, 2016

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

On this episode, you'll meet Steve Dower, 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.

Links from the show:

Python Tools for Visual Studio: aka.ms/python
PTVS Blog: aka.ms/pythonblog
Steve on Twitter: @zooba
Steve on Web: stevedower.id.au
Visual Studio Community Edition (Free):
visualstudio.com/en-us/products/visual-studio-community-vs.aspx
BUILD 2016 Keynotes: channel9.msdn.com/Events/Build/2016
Visual Studio Code (cross platform): visualstudio.com/products/code-vs.aspx
Ubuntu on Windows (Native): .hanselman.com/blog/DevelopersCanRunBashShellAndUsermodeUbuntuLinuxBinariesOnWindows10.aspx

Episode Transcript

Collapse transcript

00:00 What's your favorite Python editor?

00:01 That's one of the questions I always ask at the end of each episode.

00:04 This week, I want to shine a light on a fantastic answer to that question for Windows developers.

00:09 Visual Studio.

00:11 On this episode, you'll meet Steve Dower, a Python core developer from Microsoft's Python Tools for Visual Studio team.

00:18 He's here to tell us all about it.

00:19 We also cover Python on Windows, Cpython, the 2016 Build Conference, and more.

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

00:30 Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the ecosystem, and the personalities.

00:59 This is your host, Michael Kennedy.

01:02 Follow me on Twitter, where I'm @mkennedy.

01:04 Keep up with the show and listen to past episodes at talkpython.fm, and follow the show on Twitter via at Talk Python.

01:10 This episode is brought to you by SnapCI and OpBeat.

01:14 Thank them for supporting the show on Twitter via snap underscore CI and OpBeat.

01:19 Steve, welcome to the show.

01:21 Hi, Michael. Thanks for having me.

01:22 Yeah, we've got some really cool stuff to talk about.

01:24 I'm super excited to talk about what you guys at Microsoft are up to with bringing Python into all of your major dev products,

01:32 Visual Studio, Azure, those sorts of things.

01:34 Yeah, no, it's really exciting.

01:35 We've been working on a lot of this stuff for a number of years, and it's really hitting a point where it's starting to come together,

01:41 and people are making good use of it.

01:42 So it's very exciting.

01:44 Yeah, I bet it is.

01:45 And we're going to totally dig into that.

01:46 But, like always, let's get started at the beginning.

01:49 Tell me your story.

01:50 How do you get into Python, programming, that sort of thing?

01:52 So my first Python experience was I got a holiday job at a startup company

01:57 that was doing medical devices.

01:59 And they had this ridiculously complicated C++ app for controlling the device

02:05 that was scriptable with Python.

02:07 So my job was basically writing the Python scripts to control these medical devices while we were testing them.

02:13 And then after that, I started grad school, and one of my supervisors said,

02:18 hey, you should pick up all of this code that I've done previously and use some of that.

02:22 And I kind of looked at him and said, is this going to help with your work?

02:26 And he's like, yeah, yeah, of course it is.

02:28 But that was all in Python.

02:29 So at that point, I was neck deep in it and have not yet seen a reason to come out.

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

02:38 It's great.

02:39 It's just so flexible.

02:40 And it has so much power that users don't actually have to see in the code that they write.

02:45 One of my favorite things is writing really complex libraries that look incredibly simple to use.

02:51 And Python's magic, metaclasses, decorators, makes that just really nice.

02:57 You can do a lot of stuff that people never actually see or have to know about.

03:00 So you'd say that's kind of a different experience than if I was writing C++ with templates and multiple inherences

03:05 and all that kind of stuff, right?

03:06 C++.

03:09 I actually put C++ in the same category.

03:11 I quite like writing templates in C++, yeah.

03:14 But it's definitely a different category from Java or C# where you just don't have the ability to hide so much

03:20 of the implementation from what users get to see in the code.

03:23 So the interfaces are a bit more restricted in those languages and you use what you get.

03:28 Yeah, that's for sure.

03:29 You work at Microsoft.

03:30 You said you've been there like four years or so, right?

03:33 Yep, coming up on four years, which means following our usual tradition,

03:36 I need to provide four pounds of candy for everyone, which I'm sure my weight-conscious colleagues

03:43 are not looking forward to, but I'll make them indulge.

03:46 There you go.

03:46 That would probably be easier to do if your job anniversary was around Halloween.

03:50 The stores are stocked.

03:52 Yes.

03:53 With candy.

03:54 Or just after and then get all the discounted stuff.

03:57 Exactly.

03:57 That'd be the best time.

03:59 So how'd you get there?

04:00 I actually got there through contributing to the Python Tools for Visual Studio

04:04 that I'm working on now.

04:05 That was one of the earliest open source projects to be done out of Microsoft.

04:10 It was one of the very first to accept external contributions, and so I was contributing.

04:14 And that led to an offer of an internship, and so they brought me out from Australia for three months.

04:20 And the nicest three months of the year in Seattle are June, July, August,

04:24 so they brought me for those three months and got to the end and said, what do you think?

04:28 Do you want to stay?

04:28 And I'm like, wow, it was beautiful weather.

04:30 It was sunny.

04:31 It wasn't too hot.

04:32 This sounds great.

04:33 Yeah, I'll come back.

04:33 And so, yeah, I was contributing to an open source project that turned into a full-time job and a career

04:40 writing open source projects at Microsoft.

04:43 Yeah, that's really awesome.

04:44 I think those months that I think, you know, I spend a lot of my time in Portland,

04:48 and we have basically the same weather.

04:51 Those are like the marketing months, right?

04:54 People fall in love with the city and the surroundings then, and then the season of rain comes for the next six months.

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

05:01 It is.

05:02 But you know what's really good is you're not driven to go outside.

05:06 You're not pulled to go out into the nice weather.

05:07 You can just focus, do some programming for six months, and come back out when the sun shines.

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

05:16 Yes, it is strange that way.

05:18 Very nice.

05:19 So that's great.

05:20 I expect back in that time frame, not so many people were hired at Microsoft to write open source.

05:26 I don't honestly know how many people were doing it at that time.

05:29 There were not many.

05:30 So my team worked really hard to get the Visual Studio support for Python

05:35 to be written as an open source project, and many, many meetings with lawyers.

05:40 I mean, these days, to release something under the MIT license or the Apache license is really, really easy.

05:46 But at that point, they spent months dealing with lawyers, explaining what everything meant,

05:51 letting the lawyers do their research and find their backgrounds and just figure out,

05:56 is it safe for us to be releasing this stuff under this license?

05:59 What's our risk?

06:00 What could go wrong?

06:02 And eventually, the team just pushed hard enough to make it happen.

06:05 And without that, there was no open source coming out of Microsoft for the largest part.

06:10 Yeah, that's really cool.

06:11 And back then, that was such a new idea, at least in that space.

06:16 Obviously, open source had been alive and thriving, but large corporations doing major open source

06:22 outside of a few places like Red Hat.

06:24 That was pretty rare.

06:25 So it's cool that you kind of got to be part of that seed there.

06:29 And I think in the early days in Microsoft, a lot of their attempts to do open source

06:35 came in what I'd consider like source open rather than open source, which means you may see the source,

06:41 but there's not the pull requests and take backs.

06:44 And this stuff wasn't really there in the early days for a lot of the projects.

06:48 Like I'm thinking of ASP.NET, for example.

06:49 Yeah, absolutely.

06:50 And some of the licensing that we did, again, it's all about managing risk.

06:54 And clearly, at some point, there were a couple of lawyers that, or the entire legal department,

07:01 decided that the best way to manage that risk would be to create licenses that had exactly the clauses

07:06 that we were concerned about.

07:08 And so we had the Microsoft public license, Microsoft reciprocal license,

07:12 were invented and used for a while.

07:15 And fundamentally, I don't think there's anything wrong with those licenses,

07:18 apart from the fact that they weren't the ones being used by the community at that point.

07:23 And they never really became common use in the community.

07:26 So people who are used to saying, oh, this is Apache, this is MIT, this is BSD,

07:31 I know what these mean, these are familiar, suddenly you see an unfamiliar license.

07:35 And without being a lawyer, going through and figuring out that it's the same is,

07:39 it's not a difficult task, but it's legal work.

07:43 And so I think people were just seeing those licenses going, I don't really trust this,

07:49 I don't know this, I don't understand this.

07:51 Much the same as the people who created those licenses were probably looking at the other ones going,

07:56 we don't understand these, we don't trust these.

07:58 What if, what if, what if?

08:00 Yeah, this is so different than my corporate software EULA agreement I normally have,

08:05 this MIT thing, so bizarre.

08:07 Yeah, and there's basically no language shared between the two.

08:11 If you go and actually read some of the corporate EULAs, that nobody spends that much time looking over.

08:17 And I'm sure there's some very disappointed lawyers who put a lot of effort into writing those,

08:21 that most people don't actually read them.

08:23 Yeah, that's too bad.

08:24 I guess probably in the early days, those types of licenses felt just like,

08:28 oh, here's a company trying to do open source, but they obviously don't fit in.

08:34 They just look different.

08:35 So they must not really be doing it or something.

08:37 But you guys have adopted the more mainstream stuff these days.

08:40 You've moved a lot of your source code to GitHub.

08:43 You've got more standard licenses, things like that, right?

08:45 Yeah, and at this point, as I said, for teams that want to do open source work within Microsoft,

08:51 basically the only choice of license is MIT these days.

08:55 Apache 2 still gets some use, and I think there's a slight movement away from that,

08:59 just in terms of what I'm seeing happen at the company.

09:02 It's all about where are people actually doing this?

09:05 How are they actually doing it?

09:06 And we've also had sort of a generation of engineers coming in who are familiar with all this.

09:11 So basically everyone working at the company that's under 30 has used GitHub for their own projects.

09:17 They've been using proper open source.

09:19 They've been releasing their own code under open source for years already.

09:23 And so they come in, and suddenly you've got this entire band of junior engineers

09:27 who know how it should be done, know how everyone else expects it to be done,

09:31 and is willing to push and make it happen.

09:33 So over time, we have definitely moved to a much better place as far as having,

09:38 as far as, I don't like saying joining the open source community because it sounds like it's really forced,

09:43 but we've definitely got more products that are considered genuinely open source projects at this point.

09:50 Yeah, definitely embracing the concept and the community of open source more.

09:54 So that's cool.

09:55 So let's talk about Visual Studio and specifically the Python support that you guys built.

10:00 Now, I have a pretty wide range of listeners.

10:02 I suspect most of them know what Visual Studio is and the history there,

10:06 but could you give us like the 30-second pitch on what is Visual Studio,

10:09 where did it come from, and why is it special that it has Python support now?

10:14 I suspect Visual Studio is probably older than me in a lot of ways.

10:18 It's a very old project that's basically Microsoft's development platform.

10:24 So developers who need access to editors, tools, debuggers, and all of the things that come with building

10:32 and managing and releasing software typically find themselves inside Visual Studio.

10:36 I first started using it as Visual Basic 4, which was a long, long time ago,

10:41 and it's grown out of that.

10:44 I don't have the full history hand here in my mind.

10:47 I mean, at that point, I was a hobbyist and not an employee.

10:51 But these days, Visual Studio is very much the development platform.

10:55 It's the integrated environment that has all of the editors, all of the tools,

11:00 all the languages that Microsoft supports development in go through Visual Studio,

11:04 all of our platforms that you may want to build things for or deploy things to.

11:09 So everything from Xbox through to phones, which includes all phone OSs at this point.

11:15 You'll go through Visual Studio for building, debugging, deploying, testing.

11:19 It really is the home for Microsoft developers.

11:23 Yeah, so bringing Python support to that is something that our team has been really keen to do for a long time

11:30 just because it's already the home for so many developers.

11:34 And so people who are using C++ or people who are using JavaScript and may want an alternative for another language

11:41 have historically been switching out to other editors.

11:44 And there's no need for that.

11:46 I mean, Visual Studio has great support for so many languages that having Python in there as well

11:51 is something that we've always been really keen to have.

11:54 So we've been working on that for years.

11:55 And at this point, it's right up there with the other languages, which is great to see.

12:00 Yeah, that's really great to see.

12:01 And we don't often just work in one language anymore, right?

12:05 Like, if you're going to build a web app, you're probably doing some T-SQL.

12:09 You're doing Python.

12:11 Obviously, if you're doing it in Python, you'll be doing some CSS, some HTML, some JavaScript.

12:16 And the fact that Visual Studio is really good at all of those things and now Python as well,

12:22 that's really cool because it brings them all together really in one place.

12:26 You don't have to jump around, like you said.

12:27 So can you maybe contrast, like, the development experience with, say, like Sublime or Emacs?

12:34 Like, why would somebody who's like, I love Sublime, start super fast, it's lightweight, it's free,

12:39 unless you pay for it.

12:41 But it'll let you use it for free, basically.

12:42 I think it's $59 officially.

12:45 And contrast that with, like, Visual Studio.

12:48 Like, how much does Visual Studio cost to get going with?

12:51 Depending on what you're planning on doing with it, Visual Studio is probably free.

12:55 Visual Studio Community Edition was released, what was that, a year, two years ago?

13:00 And that's still part of the current release, is the free version.

13:04 And that's available if you're basically not a huge company or you're working on open source software.

13:10 You can freely use Community Edition, which has all of the features of the Professional Edition.

13:16 It doesn't have the enterprise-level features, but that's mostly, I believe,

13:22 application lifecycle management stuff that, well, some people absolutely love it, require it,

13:27 and we use it a lot internally at Microsoft.

13:29 It's not critical for small projects.

13:31 And certainly, if you're using GitHub or some form of public issue tracker,

13:35 it's not actually that valuable for you, given my understanding.

13:38 But the free version is widely available, and that includes all functionality.

13:44 And everything from Python support, Node.js support, and even as we just announced the other week,

13:51 that's going to include Xamarin for all the cross-platform work that people want to do these days.

13:56 Yeah, Xamarin's an interesting story.

13:58 I don't want to go down that rabbit hole, but just so people maybe don't know,

14:03 Microsoft purchased Xamarin about a month ago.

14:06 And Xamarin is basically a development environment for taking code, C-sharp code,

14:13 and building cross-platform apps that feel native, right?

14:17 Like, for example, I learned at Build, watching some of the Build videos,

14:21 doing some research on this stuff, that Slack builds their mobile apps with Xamarin.

14:27 That's pretty cool.

14:27 This episode is brought to you by SnapCI, the only hosted cloud-based continuous integration

14:48 and delivery solution that offers multi-stage pipelines as a built-in feature.

14:53 SnapCI is built to follow best practices like automated builds, testing before integration,

14:58 and provides high visibility into who's doing what.

15:01 Just connect Snap to your GitHub repo and it automatically builds the first pipeline for you.

15:06 It's simple enough for those who are new to continuous integration, yet powerful enough to run

15:11 dozens of parallel pipelines.

15:13 More reliable and frequent releases.

15:15 That's Snap.

15:16 For a free, no-obligation, 30-day trial, just go to snap.ci slash talkpython.

15:22 Yeah, no, it's really nice to have, like, getting back to the right ones run anywhere,

15:36 but it's a genuine run in the place where you are and not sort of the old

15:41 completely locked-down virtual machine run anywhere that we had in the early days of Java.

15:46 Yeah, where you'd open an about box and it looked clearly foreign.

15:50 Yeah, exactly.

15:51 You'd open it like a file browser and it was obviously not part of the OS

15:55 or something like that, right?

15:56 Yep.

15:56 Compared to something like Sublime that's sort of really lightweight, Visual Studio,

16:01 you're going to find a more featureful experience.

16:03 So, I know a lot of people love Sublime because it opens quickly.

16:07 Visual Studio can open quickly, quite often, and they're certainly always working on improving that.

16:12 But the big difference is once you're in, Visual Studio has much, much better IntelliSense

16:17 for every language that it supports than you'll find in a lightweight text editor.

16:21 And even a lot of the plugins for Emacs and VI don't actually reach the same level of intelligence

16:28 about your code that we have in Visual Studio.

16:31 So, things like understanding decorators, recognizing what types have gone into a tuple,

16:37 and then when you expand that out later, we still know those types.

16:41 Things like what items have been added to a list.

16:43 So, when you iterate over that list later, we can say, yeah, we know it's one of these types

16:47 because these are all the things that you've put into the list everywhere else in your code

16:51 for this particular list.

16:53 Right.

16:53 So, you get like IntelliSense on the item to the list in your foreign loops,

16:56 for example, right?

16:57 Yeah.

16:58 Which demos really nicely most of the time.

17:00 But it is certainly a feature that's very unique to the integrated development environments,

17:05 the bigger, heavier weight tools that I guess the current generation of advanced text editors

17:12 we're seeing like Sublime, like Atom, like Notepad++, just don't have that same level

17:17 of intelligence about the code.

17:19 I think that sums it up pretty well.

17:20 And people who listen to the show a lot know that I kind of come down on preferring the heavyweight IDE stuff

17:26 that really helps once you get it started with large projects and understanding your code.

17:30 But I know that not everyone is that way.

17:32 So, it's interesting to look at the both sides.

17:35 Yeah.

17:35 Yeah.

17:35 And it's definitely interesting to see the difference between different communities of people

17:41 when it comes to this.

17:43 Because I find so, at Build last week, talking to a largely Microsoft audience,

17:46 everybody knows Visual Studio, everyone loves it, and they don't really know Python that well.

17:51 But that means that when you get up and show IntelliSense demos, they're just not impressed

17:56 because they're used to Visual Studio.

17:58 And they're like, well, you're in Visual Studio.

17:59 Of course you get IntelliSense.

18:01 Why are you showing me this?

18:03 Whereas when you go to the Python audience, and even people who will flat out say,

18:06 I don't want to use an integrated environment, it's too heavyweight, it doesn't add any features,

18:11 and then you show them that you can go to any variable and hit F12 and see everywhere that it's been assigned,

18:17 or go to the very first place it was defined.

18:19 You can override and monkey patch functions and see all the places where those were changed

18:25 and where they all came from.

18:26 And suddenly they go, oh, wow, this is amazing.

18:28 Maybe I do want the heavyweight environment if it has this kind of magic functionality in it.

18:34 That's right.

18:34 Maybe it's worth waiting that three seconds for it to start or whatever,

18:37 because you're going to be in it for the whole day.

18:39 So let's talk about some of the features.

18:41 Before we do, one thing that you mentioned in some of your conversations

18:46 in Build Conference was sort of about Iron Python and Python 2 and Python 3 support,

18:51 specifically CPython.

18:52 Some people listening might be thinking, well, this is Microsoft, it's Windows, it's Iron Python,

18:56 which is the Python that runs on top of the .NET CLR.

19:00 Yeah, so Iron Python was a project started at Microsoft.

19:04 I don't remember exactly when, possibly as long as 10 years ago at this point.

19:08 When they were building the common language runtime, there was a small team that decided

19:13 we should build a dynamic language runtime on top of this as well.

19:17 So effectively using the .NET platform to do dynamic languages.

19:21 And as part of that, they built Iron Python and Iron Ruby to use that runtime

19:25 as, you know, you need to make sure that it's actually valid by doing something useful with it.

19:30 And then when that project eventually was not advancing any further in that form

19:36 and some pieces were taken and used for other things, so people familiar

19:40 with the dynamic keyword in C# will probably recognize that that came out of that work.

19:45 But Iron Python and Iron Ruby were effectively pushed out to the community

19:49 around about 2009, 2010.

19:51 And since then, Iron Python's been maintained externally.

19:55 Microsoft has nothing official to do with it anymore, though we do occasionally

19:59 contribute to it.

20:00 But it is, it's Python on top of .NET.

20:03 And a lot of people still use it.

20:04 It gets a lot of love, especially from people who have sort of C# or F Sharp assemblies

20:11 that they want to use from Python or they want to test from Python because it's so natural

20:14 to just load those up with an import statement and call into it.

20:18 But there is a big assumption that being Microsoft, that's all we care about.

20:23 And that's absolutely not the case at this stage and hasn't been for six years.

20:27 When that project was released and we started on the Visual Studio support,

20:31 it was really, really clear that 99 plus percent of Python developers were using CPython

20:38 and there was just no way that we could cut those people out and say, well, you've all got to switch

20:44 to .NET to use this.

20:45 That would have been just ridiculous.

20:47 So we didn't do it.

20:47 Yeah, and the guys with things like NumPy, they're like, you know, I kind of like this library.

20:52 I'd like to see integration with this package and I don't want to just do some .NET thing.

20:58 So obviously, right?

20:59 Yeah, and NumPy is hard enough to build on Windows already that we wouldn't want

21:05 to be forcing people to have to build it as part of IronPython.

21:07 Though we did try that for a while.

21:09 There was a project to get that working that eventually just ran into too many issues.

21:13 But yeah, CPython is sort of the main star of the show.

21:17 for us.

21:18 So the Visual Studio support extends from CPython 2.5 through to 3.5 with every version in between

21:25 and 32-bit, 64-bit and everything from debugging, profiling, IntelliSense.

21:32 We have all the context-sensitive keywords like async and await.

21:36 We handle all the future imports for CPython properly and all the other interpreters

21:41 are supported as well.

21:43 And frankly, they tend to come off a bit like a second thought compared to CPython.

21:50 We're very much focused on the same area that the entire Python community

21:53 is focused on.

21:54 So PyPy, Jython, IronPython, we test, we use a bit, but CPython gets the bulk

22:01 of the work.

22:02 I kind of feel like the entire community is just going to use CPython unless there's some

22:06 huge pressure from a performance problem or some other type of thing that forces them to

22:12 go and find some other interpreter or runtime like PyPy, which is really cool,

22:17 but it's just not the standard.

22:18 So you've got to have a really good reason to do that, right?

22:21 Yeah, and frankly, I'm a little disappointed that Jython didn't get a nice big boost

22:25 from Minecraft integration.

22:26 I was really hoping that was going to push it a long way along, but that doesn't seem

22:33 to have happened.

22:33 I know a few people have done it, but that could have been a lot of fun.

22:36 Yeah, yeah, too bad.

22:38 Let's talk about some of the project types and types of apps that you can build

22:43 with Visual Studio Python support.

22:45 So you guys have web apps, right?

22:47 Yeah, so a project in Visual Studio, for those who don't use it, is essentially

22:51 just a collection of files.

22:53 You can think of it as these are the files that all relate to this one project.

22:58 It's roughly equivalent to these are the ones that I check into source control

23:01 or the things that I may want to edit within Visual Studio, but a project also includes

23:06 things like launch options, debugging options, and so there's a few sort of categories

23:11 of those that we like to start with.

23:12 So web projects quite often have different launch options.

23:16 So rather than just typing Python name of the script, you'll do python-m bottle

23:21 name of the script, or python manage.py run server to get it going.

23:25 So they have different launch options.

23:27 So we provide some projects that pre-configure those effectively so that when you go

23:32 and hit F5 to start running, it's already set up for running that web project.

23:37 but the project itself is not actually that constraining and it's quite easy

23:42 to configure a regular project to be a Python project and we've actually

23:46 got some future work coming, which I think we'll talk about future work in a bit,

23:50 that we'll just get rid of projects completely.

23:52 Oh, how interesting.

23:53 Okay.

23:54 Well, that sounds really cool.

23:55 So if I have like a Flask app and it's got all of its templates, does it understand,

24:01 does Visual Studio understand like the Jinja 2 or Chameleon templates?

24:06 So we don't have Jinja 2 yet.

24:08 A while back, we invested in Django templates and have that there.

24:12 So if you're using Django and using the Django template syntax, now this is before

24:17 they offered Jinja 2 as an option, then you'll get IntelliSense within the template file,

24:22 you'll be able to debug, you can set a breakpoint in the template and it'll stop

24:26 and you can step through your template as it's being generated on your local machine.

24:30 Yeah, the debugging of the templates, that's pretty awesome because sometimes

24:33 when template binding goes wrong, you're just like, why is this not working?

24:37 It's really hard to understand like when it's handed off to the template engine,

24:41 like what's going on anymore?

24:42 So that's pretty cool.

24:43 Yeah, and definitely when things go wrong, you don't always get the nicest stack trace

24:47 out of it.

24:48 So being able to stop execution just before something gets rendered incorrectly and inspect

24:53 and see what's going on is really helpful.

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

24:59 Yeah.

24:59 Or your data going to the template.

25:01 Sorry, because it's just the call stack of like the template parsing.

25:04 So that doesn't help.

25:05 Yeah.

25:06 Sort of generic Jinja 2 support is on our wish list of things we'd love to do.

25:10 We briefly investigated updating the stuff we have for Django to support Jinja

25:16 and it's not quite feasible yet.

25:18 Django, original style Django templates were mostly handling with regexes

25:23 because they have a more restricted format.

25:26 Jinja 2, you can't do that.

25:28 Jinja, we need like a full HTML slash Jinja parser to be able to figure out

25:33 how it all works.

25:35 So that's on our wish list.

25:37 We'd love to have it and we just haven't had a chance to get to it yet because turns out

25:41 writing a parser is a big task.

25:42 Yeah, I'm sure that it is.

25:44 So if somebody's out there listening, they're like, I could totally write that parser.

25:48 Do you guys take contributions and stuff?

25:50 Absolutely.

25:51 GitHub.com slash Microsoft slash P-T-V-S.

25:54 That's Python tools for Visual Studio and yeah, come let us know that you're interested.

25:59 We're happy to help you out and we'll accept pull requests.

26:03 We've already accepted one for our next big release.

26:05 So people who are looking for brace completion, that was contributed by an external person

26:11 who basically just came along and said, I really want this.

26:13 I'm willing to do it.

26:15 Here's the code.

26:15 What do you think?

26:16 Oh, lovely.

26:17 This episode is brought to you by OpBeat.

26:32 OpBeat is application monitoring for developers.

26:34 It's performance monitoring, error logging, release tracking, and workflow

26:38 in one simple product.

26:39 OpBeat is integrated with your code base and makes monitoring and debugging

26:42 of your production apps much faster and your code better.

26:46 OpBeat is free for an unlimited number of users and starting today, December 1st,

26:51 OpBeat is announcing that their Flask support is graduating from beta to a full commercial product.

26:56 Visit opbeat.com slash Flask to get started today.

27:08 So one thing that I saw that you guys can do, I think it's sort of special

27:13 because the deep relationship with C++ and C and Visual Studio.

27:17 Like, my first experience with Visual Studio was with Visual C++ 1.52 back in like 1994

27:24 or something.

27:25 So it's been C++ capable for quite a while.

27:27 And one of the things you can do is you can like mix mode, you called it

27:31 mix mode debugging, right?

27:32 That sounded pretty cool.

27:33 Can you talk about that?

27:34 Yeah, so it's actually one of our most popular features.

27:37 It's unique to Visual Studio.

27:39 We're not aware of any other development environment out there that can do this.

27:43 Though GDB has some extensions that get kind of close.

27:46 What it essentially is when you have Python code calling into a C module,

27:51 so one that you've written and built yourself, when we have the debugging information,

27:55 we can give you a debugging view of both the Python and the C code simultaneously.

28:00 So you can set a breakpoint in the C code.

28:03 You can set breakpoints in the Python code.

28:05 You can inspect variables in each one and see, so from the C code, oh, I've got a PyObject star.

28:11 If I hover over it and have a look, it'll show me what it would look like

28:14 as a Python object, whether, you know, a list of items or a tuple or a dictionary

28:18 and step between the two different worlds.

28:22 And so you end up with this call stack that goes Python, Python, Python,

28:25 Python, C, C, C, C, Python, Python, Python, which is amazingly helpful when you're trying

28:31 to debug native modules.

28:33 It's actually something that I had to do a lot when I first started and we didn't have this feature.

28:38 So I know how incredibly painful it is to do without having this sort of layer on top

28:43 that shows you all the actual Python values that you'd be missing otherwise.

28:47 That is super helpful.

28:48 So I guess anyone out there is listening who's writing some sort of C extension

28:52 and wants to help debugging it, you know, try the free Visual Studio version with Python tools

28:58 included.

28:58 That'd be awesome.

28:59 So you want to talk about some of the other project types?

29:02 one of the things that seems like Microsoft is up to these days, last four,

29:08 three or four years, ever since such a Nadella's taken over, I guess, is you guys seem

29:13 to be all in on Azure.

29:15 And so you could actually have support for Python and sort of deploying straight out of Visual Studio

29:19 into like a web app running on Azure, right?

29:22 Yeah, so Azure web apps, kind of the highest level, most managed platform,

29:27 I guess, for deploying websites.

29:29 It's really, really quick to just push up the code for a site to, and now you have

29:35 an active website.

29:35 So there's no setting up machines, there's no installing web servers or doing some

29:40 machine level configuration.

29:42 It is within a minute of saying, I would like a website.

29:46 You've got a website, which is really, really cool.

29:49 And so the support that we have inside Visual Studio for that just brings that down.

29:54 It's just bringing the click count down because you can do all of this through FTP

29:58 or you can do it through via a Git repository.

30:01 And then there's sort of the one click, I have my files here on my machine,

30:06 I want them on that machine, just go and do it and we'll go off and do it.

30:09 I really like the websites that you guys have in Azure.

30:12 Like if I need a little small website that I can just spin up really quick,

30:16 my first thought often is just go to Azure because there's nothing to set up.

30:20 And you can have up to 10 sites, I think, for free, like 100% free forever.

30:25 That's pretty awesome.

30:25 Yeah, I think 10's the limit there.

30:27 And I mean, if you want to try it without even signing up, then you can go to,

30:30 I think it's try.azurewebsites.net and we'll give you a free site for an hour

30:35 without any sign up, no credit cards or anything at all.

30:39 We'll just give you a site, we'll give you a Git repository and so you can push

30:42 directly to the site and have a website running.

30:46 And there's a whole lot of templates in there if you want to start from a Django

30:50 or a Bottle or a Flask site or if you're interested in doing it in PHP or Node.js,

30:55 we have like, all of the languages are supported for websites and so that

31:00 try.azurewebsites.net is just a really quick way to get a website going and see whether

31:05 it does what you want it to.

31:07 another one that I saw that I have no experience with so you'll have to tell me

31:10 a little bit about it is when I was playing with the Python projects, I saw that you have

31:16 a Windows Internet of Things core, maybe Windows core for Internet of Things,

31:19 as a Python project type.

31:21 What's that?

31:22 There's a team at Microsoft at the moment that's been working on what's known

31:26 as Windows IoT core.

31:28 It's basically a version of Windows that is really, really stripped down.

31:32 It's still sort of the latest builds of Windows but there's a lot of unnecessary things removed

31:36 and it's really designed to be run on like Raspberry Pi 2 or sort of about that scale devices

31:42 for sort of high level Internet of Things type tasks.

31:46 So it's not the little tiny microcontroller device that's just got a sensor attached to it

31:50 but something bigger where maybe you've got a running process that's going to pull down

31:54 a whole lot of data off the Internet, do some processing, display it on an attached

31:59 screen or device of some sort and that platform has a slightly different app

32:05 deployment model than on like the Raspberry Pi OS or some of the other IoT things.

32:10 So it is running Windows.

32:12 One of the big benefits of that is the security you get out of it in terms of

32:16 you can't just run unsigned code on it, you can't jump outside of the sandbox

32:20 that the code is running within and it has a lot of those benefits and what that means

32:25 is that you need to go through a couple of extra steps to deploy code to it

32:28 in the first place.

32:28 So that template is actually very different from all the other templates we have.

32:33 but it is a good starting point for IoT.

32:34 You jump into that, you get a special version of Python that we had to rebuild

32:39 so it's Python 3.5 rebuilt to run on IoT Core.

32:43 I believe something like 95% of the functionality is there.

32:47 There's a few features that had to be removed because they would not work within

32:52 the sandbox that's provided but within that you can set up a background service,

32:57 it can do network access, it can do processing and all of that will then be

33:01 easily deployed to Raspberry Pi 2 or any device, I forget the other ones that it will run on

33:07 but anything that Windows IoT Core will run on can run those Python applications

33:12 and from within Visual Studio you have sort of that one click deploy and run,

33:16 you can F5 to deploy and debug and we'll use our remote debugger to attach to it

33:21 and you'll get the full Visual Studio experience of stepping through, inspecting variables

33:26 while running on a little tiny device.

33:29 That sounds awesome.

33:30 I should check that out.

33:31 Yeah, and not to exclude the other ones, if you are working on an original

33:35 Raspberry Pi or a different OS then Visual Studio has remote debugging for Python

33:40 so it's a little module that you can put with your code on any platform on clusters

33:45 of Raspberry Pis and use Visual Studio to do their debugging by connecting to it

33:50 from their Windows machine.

33:51 That I haven't got to play with but it sounds really handy.

33:53 Awesome.

33:54 Can you give us a glimpse of maybe something that's coming that people don't know about

33:58 like a feature that's under development that's pretty cool?

34:01 Basically everything that we do that we're actually doing is going to show up

34:04 on our GitHub site so if people go and look at the commits there you can see

34:07 what's definitely coming sometime soon.

34:10 There's a lot of things that we talk about that don't always make it past

34:14 the talking stage so it's kind of hard to say from this huge list of stuff we say

34:18 yeah we'd love to do this we'd love to do this which ones will make it to the stage

34:22 of we're actually doing it.

34:23 One thing that is getting very close to that second step and is support for Visual Studio Code

34:29 so people who may not be familiar with that recently in fact about a year ago

34:34 Microsoft made the first release of Visual Studio Code which is a cross-platform

34:39 version of Visual Studio it's lighter weight it doesn't have a lot of the advanced functionality yet

34:44 but it's much more comparable to something like Sublime Text in terms of

34:49 I have a directory of code here I just need to jump around in it a bit I still want good

34:54 IntelliSense I still want the ability to navigate based off code semantics

34:59 rather than simple searching I need git integration I want F5 to debug and we're at the point

35:05 where 99% certain that we'll be committing to like really beefing up the Python support there

35:11 it has basic support for a lot of languages including Python but there's

35:16 not yet any debugging there's very limited or no IntelliSense and launching

35:21 is not quite there yet so there's a range of things to work on there's currently

35:25 a community extension that's doing it and we're thrilled to see that the community

35:29 has said hey we care enough about Python to make this happen regardless yeah that's great

35:33 do you know the name of the extension so people can search for it or I can link to it

35:37 the extension's Python so if you just X install Python from within Visual Studio Code

35:43 you'll get it it will make it difficult for us if we put out another Python extension

35:47 because we'll have to pick a different name oh yeah they really grabbed the main name

35:51 didn't they yeah they went and took it so there's always a possibility that we'll get in touch

35:55 with the guy who's created and say hey you've already got users you know

36:00 everyone already loves this one can we contribute to it and then you know

36:04 maybe we don't end up with a an official Microsoft one but we really beef up

36:09 the community owned and driven one already with with all of the stuff that we've got

36:13 from Visual Studio proper we'll try and bring that over to Visual Studio Code

36:17 and get that out there so not quite sure how that looks right now not quite sure

36:22 when it's going to be available but it's definitely something that is coming

36:25 and so there will be cross-platform Visual Studio Code Python support coming soon

36:30 yeah that's awesome it's nice to see Visual Studio Code coming along and with the whole

36:34 .NET Core stuff and I talked to Brett Cannon he was on show 49 about some of the

36:41 the pigeon work that you guys are doing involving .NET Core and cross-platform

36:45 so all those things are coming together really nicely but let's take it back to Windows

36:51 for just a second so as somebody who teaches Python I want to say thank you

36:58 for building the new Windows installer for CPython oh my god that has been

37:02 such a nightmare that to try to you know people come to class they've got some

37:07 crappy old laptop they got from their company you know it doesn't have Python on it

37:12 and they want to get started and they forgot to check the little box put this in my path

37:16 and it's just oh you know there were so many little gotchas and you recently

37:21 updated that in a pretty major way right?

37:23 yeah so what was it PyCon last year I think or might have been the year before

37:30 2014 I think the the person who was responsible for producing the builds

37:37 of CPython for Windows effectively resigned and said I've you know I've got other things

37:43 I need to step away for a bit so if someone else wants to take over then they're more

37:47 than welcome to and thinking it wouldn't be that much work I put my hand up

37:53 which turned out to be a silly thing to do but that's what I did and so since then

37:58 I've been largely responsible for excuse me for a lot of Python on Windows

38:04 one of the things that I've been really keen to do for a long time and was

38:10 kind of going to contribute it anyway was to rewrite the installer and I mean

38:16 frankly I'm still not entirely happy with where it's at but it's not something that you

38:20 can change dramatically too often but one of the big well I can tell you

38:25 it is a much nicer experience than it has been so I'm I can definitely say that

38:32 so people who have tried to like set up Python on Windows before and be like

38:36 oh here goes this thing it almost works it's a lot nicer so it may have ways to go

38:41 but it's great yeah and I did achieve two of the big things that I wanted

38:45 to do which was moving the default installation directory into somewhere

38:50 more secure because historically if you put Python in the root directory

38:54 of your system drive anyone on that machine can write to it and that then means

38:59 that someone who's not an administrative user can install whatever package

39:04 they want and then if someone who is an admin runs that Python at all they're going

39:09 to run that code that's been installed by someone who shouldn't have privileges

39:12 to install it for them so that was always a security concern for a lot of Windows

39:17 users a lot of corporations and so by moving it either into program files

39:22 or into the user's install directory that mitigates that attack vector which is

39:27 a real big improvement for a lot of people the other thing is a proper per user

39:31 install so previously if you installed Python you could say install it just

39:37 for me but you still had to be an administrator to actually install it so one of

39:41 the big big changes that I made in that installer was so if you choose that

39:46 and then you choose not to install the launcher for all users then you don't need

39:50 to be an admin at all and we'll just go ahead and install Python without ever

39:54 asking you to elevate so it's great for students who may not have full control

39:58 of their machine people working at companies where the machines are locked down

40:02 and they're not allowed to make changes to it you can still install Python

40:05 3.5 on those machines because we don't require to actually make changes to the

40:10 machine we just put all of Python into a directory that you have full access to

40:14 already yeah I've run into that problem more than once that people even though

40:20 they're professional developers at a company they're still not given enough

40:23 control of their machines to make system level changes which is kind of ridiculous

40:29 but it's great that that's all there so very cool let's talk about build

40:34 for a little bit so this is kind of like Microsoft's major developer conference

40:40 and you were there I saw you were giving some talks on Python you were kind of

40:44 spreading the good word of Python saying look I know a lot of you guys here

40:50 that guy is doing C++ you guys are all doing .NET but maybe you should consider

40:56 Python can you maybe give us your impressions of what you guys announce this

41:03 year and how did your session go build always has a lot of exciting announcements

41:08 and even for employees we don't know a lot of the stuff that's going to be

41:11 announced there so we're all watching the keynotes the same as everyone else

41:15 and seeing all the exciting stuff coming out I'm still waiting for the day

41:19 when we get to make some big Python announcements from the keynote stage

41:22 but that's probably a couple of years away still at this point but I'm hoping

41:26 for that but yeah there's definitely so much coming out I love the idea of

41:31 conversation bots I really like that idea of making so many of these interactions

41:37 more natural I definitely feel like we've gone from where 10 years ago you'd

41:43 call up a hotel to book no one does that anymore you go to a third party

41:50 website that will do the booking for you and it's gotten very impersonal

41:54 and I don't actually see that undoing completely but having the sort of conversational

42:00 option to do something like that where it can use context because it knows

42:04 about you having I guess an interactive dialogue to achieve a task as opposed

42:10 to where in step one step two step three wizard kind of format feels like

42:15 a great step into a really exciting future yeah it is pretty cool and just

42:19 to kind of take a step back for listeners who maybe didn't see the you guys

42:24 announced this thing called a bot framework which I then announced it and

42:32 said this is for C# and no JS bots and so of course the first thing

42:35 I did is went off to write a button Python did it work it did it worked great

42:39 the documentation is not quite thorough enough to make that easy for people

42:42 to do because the first step is install this library or install this library

42:47 and until we have a Python version of that library which is something that

42:50 I'm really keen to do now it's not quite trivial to get it up and going but

42:55 even without that I managed to get a bot going that you can chat with through

42:59 the framework and so then the nice thing about fitting into the framework

43:03 is you get all the connectors so it's instructions are provided for connecting

43:07 that bot up through telegram through twitter through twilio through so many

43:12 of these services that if you want to interact with it by email or by phone

43:17 call or sms you can just do that and so that's a really cool thing about

43:21 that framework is you write a bot once and then you can reference it from

43:25 all of these services that support bots in some form yeah it looks really

43:30 cool and for the data scientists out there listening the back end stuff you

43:35 guys are doing with machine learning and natural language processing there's

43:39 a lot of really cool semantic understanding of written text and stuff so

43:44 I think that was one of the really interesting ones you guys did a bunch

43:47 of open source announcements so we talked about Microsoft becoming more open

43:51 source this was absolutely evident there that was super cool to see but one

43:55 that surprised me I did not see coming at all was Ubuntu on Windows tell me

43:59 what that is I don't think anyone saw that one coming I wouldn't have been

44:03 surprised if the CEO whenever they went and told Satya hey we're going to

44:07 announce this at build if he wasn't completely shocked out of his seat no

44:10 it it really cool it is like so I've had a chat with those guys and it really

44:17 is such a nice thin layer on top of the Windows APIs that you'd never see

44:22 so it's not like Sigwin where you have a different set of libraries to build

44:26 against it's a kernel shim so everything is already built for Ubuntu and

44:32 it is literally we just copy the binaries over and every time they go to

44:35 call into the kernel that gets intercepted and rewritten into the Windows

44:39 kernel calls but it's completely transparent you don't have to rebuild anything

44:44 you don't have to change references and so when you get bash and you just

44:49 get into and start calling stuff it's all the exact same elf binaries as

44:53 you'd have on a machine that has Linux all the way through instead of being

44:58 this layer on top of Windows and the thing that really blew me away is I

45:02 didn't test this but I saw the blog post the performance is apparently right

45:05 up there with a native Linux machine which is incredible that's really awesome

45:09 so people who love their Linux tools which a lot of Python developers do

45:14 this is coming to Windows basically in a native sense right what's the timeline

45:19 did you catch that no I didn't catch the timeline but I understand it's in

45:24 the current preview releases so if you're part of the Windows Insider program

45:27 then you should either have a build with it or you'll soon be getting a build

45:32 that will let you try it out I I got the since it was coming with the anniversary

45:36 update of Windows 10 I expect that's when it'll come out but certainly there

45:41 are early builds available I've used one but I get access to the daily builds

45:45 but the insider builds are not that far behind they're typically only three to

45:49 four days behind what we have access to as employees so there should be one

45:53 out there at this point already though I haven't checked so I could be wrong

45:56 but it's very cool yeah I'll be sure to link to that in the show notes as well

46:00 all right Steve we just have a few more minutes so time for a couple of closing

46:05 questions this one is going to be a softball for you what's your favorite

46:11 Python editor Visual Studio that's awesome isn't that the answer everyone gives

46:16 yeah that's well I am trying to spread the word I think it's great what you guys

46:21 are doing there so congratulations on that and I always ask you know there's

46:25 so many packages on the Python package index on PyPI at least 75,000 last time

46:31 I checked the number there's got to be a bunch that you use that maybe people don't

46:35 know about you like you should check this out it's awesome what one's yours

46:38 that comes to mind well okay so leaving out the ones that I've written myself

46:42 because that seems a little unfair though I do like the project Oxford library

46:47 which does text-to-speech and speech recognition and natural language understanding

46:51 using what's now called the Cortana intelligence suite that's a fun little

46:55 demo one that I wrote probably and certainly if you asked all my colleagues

46:59 I talk about requests all the time and and that's largely because I keep

47:02 seeing code that's using htplib and my answer is always just use requests

47:07 please just use requests stop using anything that isn't requests so that's

47:12 almost certainly my favorite library and if you have used htplib stop using

47:17 it and use requests and you'll see why okay final call to action how do people

47:20 get started with this whole thing that you guys built so aka.ms slash

47:26 python is our sort of short link and that will get you to right now it gets

47:31 you to the visual studio page about Python support depending on when you

47:34 come back and listen to this podcast it may be pointing somewhere else but

47:37 that's always going to point to the best landing page for whatever Python

47:41 stuff is going on at Microsoft probably the second one is aka.ms slash python

47:46 blog which is our team's blog so we're posting about once a week on everything

47:52 from what are we doing at Microsoft with Python what is going on in the community

47:56 what some ways of improving your coding style and that's where you'll get

48:02 the latest news about whatever Python stuff is going on at Microsoft I set

48:05 it up the other day on my fresh new version of Windows 10 and it was no problem

48:11 nice and easy just install Visual Studio install Python tools and file new

48:16 project pick your Python flavor and go right it's very nice I'd also like

48:20 to add one more thing people out there listening who haven't checked out

48:23 what Microsoft is doing for a while you should check out the build keynotes

48:28 I'll link to them in the show notes there's some really different stuff happening

48:32 at Microsoft than 5-10 years ago yeah it's very exciting I love that we're

48:38 really getting innovating again definitely congrats on all the stuff you guys

48:42 are doing Steve it was great to have you on the show thanks for giving us

48:45 an this has been another episode of talk python to me today's guest was Steve

48:52 Dower and this episode has been sponsored by snapcii and opbeat thank you

48:56 guys for supporting the show snapcii is modern continuous integration and

49:01 delivery build test and deploy your code directly from github all in your

49:05 browser with debugging docker and parallelism included try them for free

49:09 at snap.cii slash talk python opbeat is mission control for your python web

49:16 applications keep an eye on errors, performance, profiling, and more in your Django, Flask, and even pyramid web apps.

49:21 Tell them thanks for supporting the show on Twitter where they're at opbeat.

49:25 I use both of these products on all the talk python web properties and you should check them out too.

49:29 They're really excellent. Seriously.

49:31 Are you or a colleague trying to learn python?

49:33 Have you tried boring books and videos that just cover the topic point by point?

49:38 Check out my online course python jumpstart by building 10 apps at training.talkpython.fm.

49:44 The reviews so far have been fantastic.

49:46 You can find the links from the show at talkpython.fm/episodes slash show slash 53.

49:52 And be sure to subscribe to the show.

49:54 Open your favorite podcatcher and search for Python.

49:56 We should be right at the top.

49:57 You can also find the iTunes and direct RSS feeds in the footer of the website.

50:01 Our theme music is Developers, Developers, Developers by Corey Smith, who goes by Smix.

50:06 You can hear the entire song on talkpython.fm.

50:09 This is your host, Michael Kennedy.

50:10 As always, thank you so much for listening.

50:13 I really appreciate it.

50:14 Smix, it's time to take us out of here.

50:17 It's dating with my voice.

50:19 There's no norm that I can feel within.

50:21 Haven't been sleeping.

50:22 I've been using lots of rest.

50:24 I'll pass the mic back to who rocked it best.

50:27 I'll pass the mic back to who rocked it best.

50:39 Thank you.

Talk Python's Mastodon Michael Kennedy's Mastodon