The Python extension for VS Code is most downloaded extension for VS Code.
Brett Cannon is the manager for the distributed development team of the Python extension for VS Code.

In this episode, Brett and I discuss the Python extension and VS Code.

Transcript for episode 117 of the Test & Code Podcast

This transcript starts as an auto generated transcript.
PRs welcome if you want to help fix any errors.

00:00:00 Brett Cannon is the manager for the distributed development team of the Python extension for vs. Code. The Python extension is the most downloaded extension for vs. Code. In this episode, Brett and I discussed the Python extension and vs. Code. This of test and code is brought to you by config cat feature. Flag service lets you release features faster with less risk and by Pi Bait’s career coaching, take your career to the next level and buy listeners like you that support the show through Patreon thank you.

00:00:44 Welcome to Test And Code because software engineering should include more testing.

00:00:52 Thanks so much for coming on the show again.

00:00:54 Yeah, of course. Anytime.

00:00:56 Anytime.

00:00:57 I’m going to take you up on that.

00:00:58 That’s fine. You’re welcome, too.

00:01:00 You and Michael and the Change Log crew all have permanent open ended acceptances to any time you want me on the podcast.

00:01:11 Awesome. Have you been on Change Life?

00:01:15 I’ve been on twice, plus a backstage.

00:01:23 Okay.

00:01:24 What’s the backstage?

00:01:29 Basically what they do is they have occasionally when they do recordings, they’ll actually trim up some of the off air stuff.

00:01:38 But what will happen is they’ll just have guests come back on to talk about just stuff. So what happened was the first time I was on the Change Log, it struck a really good conversation. I think the whole podcast recording took three and a half hours, hour and a half content. Yeah. Adam and Jared were we were just talking off air a lot. And one of the things we kept talking about was somehow ended up on The Life of Keanu Reeves.

00:02:08 Okay.

00:02:09 Actually, if you listen to my first thing with them, they actually tack it on as an extra at the end where we talk about that. Anyway, after talking about it, obviously that leads to talking about John Wick and all that. And who hasn’t hasn’t seen the movies. And I think Adam hadn’t seen all of them yet. And Jared and I had. So we started to bug each other because John Wick three was about to come out. And then he said, hey, you should go see it. And he thought, and then after we all saw it, we actually did a whole dedicated podcast episode where we all got together and just discussed John Wick.

00:02:45 Okay, I’m going to have to listen to that because I would have never even known it sort of was a big deal for the second and third movie, but I don’t think I would have even known about the first one had my wife not said, we have to watch this.

00:03:02 So it’s my wife that gets me into the good action movies.

00:03:06 Well. And honestly, the first time I watched it, I didn’t actually care for it very much. I went into it with the wrong expectations. And then after watching and hearing everyone go on about how much they absolutely loved the movie, I re watched it with a different attitude and then I came out loving it and then simply saw two and three. And then now I’m waiting for four. And they’re going to have the spin off, I think, called the Ballerina or something.

00:03:27 Yeah.

00:03:29 The ballerina from John Wick. Three, I think, is getting your own spin off movie.

00:03:34 Well, it’s a good storyline.

00:03:35 Yeah.

00:03:37 By the way, I really appreciate the Star Wars figurines in the case.

00:03:41 Looks like Princess Leia.

00:03:49 Yes. And Luke Skywalker’s down.

00:03:54 Okay. There’s enough reflection on the glass. It’s a little hard to tell.

00:03:58 He’s lying down.

00:03:59 Okay. That’s probably why.

00:04:03 And the Stormtrooper.

00:04:07 Flashbacks.

00:04:09 Does he have the Saber in the arm like the original?

00:04:12 Yeah, but the real original, he’s got the yellow saver.

00:04:15 Oh, nice.

00:04:16 So this is my Nerd Den recording studio. It’s awesome over there that you can’t see the entire wall is made of. It’s covered in.

00:04:30 What is that stuff? Velvet.

00:04:32 Forgetting the sound.

00:04:34 Yeah, because it was too echoey in here at first.

00:04:39 And my wife said, well, we have because we’re kind of weird art seen people, so we have bolts of the fabric around. So, yeah, we put it up.

00:04:51 Well, this is our Nerd one. So my wife’s a huge fan of the Jungle Books, so we have that artistic redo of the movie poster.

00:04:59 Nice.

00:05:00 That’s the Star Wars wall.

00:05:03 That’s the Star Wars Alphabet. And obviously our two and then diplomas to feel good about ourselves. Not so much on this wall, just books and tea and the Frank Wilson Award, but my wife insisted I put that one up.

00:05:17 Frank what?

00:05:18 My Frank Wilson Award.

00:05:20 What did you get that for?

00:05:23 Python?

00:05:25 Yeah.

00:05:27 There’s an annual award given out by it’s decided by the Psf and is given out by O’Reilly. It’s called Frank Wilson Award, named after Frank Wilson, who used to be an editor at O’Reilly, who passed away. And he was a big proponent of Python.

00:05:41 Okay.

00:05:42 And when he passed, they created this award in his honor, and it goes annually to people who have made contributions to the community.

00:05:51 So it’s not like the technical one. There’s a separate Psf Technical Award that they give out not quite annually for people who’ve made technical contributions. And this one’s for community. And I got that in 2016. I was actually the first person to ever receive it in person because they always hold it at Ozcon. So unless you can get a ticket to Ozcon or you can get there, people who got it before me never got to accept it. But Andrea used to work at Anaconda, and so she had to go down for a work trip.

00:06:23 So she worked with Peter and Travis back when Travis Anaconda to have me just tag along for one of our work trips that coincide with Ozcon. So I could be there to get a free Ozcon ticket and actually get the order in person. Although there’s a whole other story to that, too, because that was when Austin passed a new background check rule. And so Lyft and Uber pulled out of the city.

00:06:47 And I don’t know if you’ve been to Austin, but Austin is not a very walkable city.

00:06:53 So suddenly not having any taxis because they kind of went out of business and no, Uber and Lyft made it kind of hard to get around. And so actually the day I was receiving, I was told I was going to get at the end of the opening remarks that day. And it turned out they actually did it smack dab in the middle of the opening remarks. So I was busy walking across town to get to OSCON and stop and having breakfast this rocks and morning. And then I show up and then I sit down and then people are going like, Mike Pernat and it’s like, Where you been? Why weren’t you here? It’s like, what do you mean? They called your name? You weren’t here. What are you talking about? They told me they’d call me at the end of the opening remarks and then my wife stormed off, pissed, like they totally told me wrong and they found them and they called me up later and all that.

00:07:35 The whole thing.

00:07:36 Okay. Wow, cool.

00:07:38 That’s the Frank Wilson Award.

00:07:40 I think the only award I had, actually.

00:07:43 I don’t know if I’ve ever gotten.

00:07:47 When I was in grade school, I was in a bowling League and I got most improved bowler.

00:07:53 Oh, nice.

00:07:55 I was still the worst bowler, but I was most improved.

00:07:58 There you go.

00:07:59 Yeah.

00:08:00 So when did you do this? In school?

00:08:02 Oh, this was like in 3rd, 4th grade or something like that.

00:08:08 You do that? Cool.

00:08:09 I did bill years for part of my master’s degree.

00:08:12 Oh, really?

00:08:13 And yeah, fencing while I was in junior College.

00:08:17 Wow. What’s the weird sports that got PE credit for?

00:08:21 Mostly I played football in high school.

00:08:24 American football, I assume.

00:08:25 Yeah.

00:08:26 Well, we have Canadian football up here, which is like American football, but extra 10 meters.

00:08:31 But in free time. I spent most of my time on a skateboard.

00:08:36 But we don’t get a letter jacket for that. Mostly get you all that.

00:08:41 But I wanted to actually talk to you, to you about Vs code.

00:08:46 Is that how you pronounce it?

00:08:48 Vs code?

00:08:50 Yes.

00:08:50 I mean, that’s what I say. But there are some people that just call it code, and some people, I assume stands for Visual Studio. So does anybody sound out the whole thing.

00:09:02 People are marketing sometimes that’s about the only people I know who consistently do it.

00:09:06 The real trick is everyone always forgets the space between the Vs and the code bit, including other people within Microsoft. But yeah, pretty much everyone just calls a Vs code, to my knowledge.

00:09:16 Okay.

00:09:17 Why the Vs? Because it’s not part of Visual Studio.

00:09:20 It’s part of the Visual Studio family.

00:09:26 Yeah. I think basically when they launched it they wanted to have some association back to Visual Studio for some name recognition for those who didn’t know about it. And then Visual Studio code is taken off so much that it’s almost overtaken Visual Studio in terms of the branding, recognition. And so the Visual Studio aspect kind of become a little interesting because the original Visual Studio doesn’t have an extra thing on it. But like, for instance, we now have Visual Studio online, which kind of ties back into that. And that’s basically Vs code in the cloud.

00:09:56 But basically internally, what we do is we have Vs code and we call it bigvs for the main Visual Studio, and that’s how we typically differentiate.

00:10:07 Okay.

00:10:08 I like the family analogy.

00:10:10 It’s kind of like the punk nephew.

00:10:20 I can’t remember. What’s your involvement with it.

00:10:23 So my official title at work is I’m a principal software developing manager of the Python extension for Vs code.

00:10:32 Is that on your business card? Just saying.

00:10:36 No, actually, because that was the title change of about a year ago. And I got my business cards before then. So I think my business cards just say principal software developer or just software developer. I don’t remember.

00:10:45 Basically, I manage the development team that leads the Python extension for the Esco. Okay.

00:10:55 And how big is the team? Can you tell me?

00:10:58 Yeah, well, usually just look at our GitHub repo and just to see who the top commanders are, and you’ll very quickly figure it out.

00:11:05 So our work group so me and sibling teams that contribute to the extension. So there’s what we call the core extension, which is everything. That is not our Language Server and not Data Science.

00:11:18 That is the team I’m in charge of. And there are we’ve got five people on the team, plus me.

00:11:29 Okay.

00:11:29 And then we have Data Science, which is another four depending on how you want to count.

00:11:35 And then we have Language Server, okay. Which is not quite it, which is run a bit more independently because the Data Science team directly commits to the same repo as us. Well, Language Server does their own thing.

00:11:49 So does it say Data Science people have their own leader, or are you. Okay.

00:11:58 And then remind me that how old is the Python extension?

00:12:05 I believe Don told me that he started it.

00:12:15 So it’s getting over three years at this point. Okay. It was actually one of the first extensions for Vs code. Okay.

00:12:22 And then Don what’s his last name?

00:12:24 Jaymonny.

00:12:25 Okay. And he’s the dude that started it before it got swallowed by Microsoft.

00:12:31 No.

00:12:32 Yeah. Basically what happened was Don started in his spare time because he wanted to develop some stuff on his Raspberry Pi using Python. He wanted to use that as a way to actually learn Python. Don didn’t really use it before, and then he did it, and then people just started to use it more and more. And what happened was at one point, he got contracted by the Vs code team to help out to build up the extension a bit more and to help them with some things.

00:13:00 And then after his contract ran up, we actually extended an offer for him to join the company and officially bring the extension over with him so that we could pay him full time to work on it. And he’s actually sell the company. He works on the data science side now.

00:13:15 And then he joined September of 2018.

00:13:20 Okay, cool. So it was just like a year outside of Microsoft, and then now it’s been.

00:13:30 Have you been there since September of 2018 or.

00:13:32 No? I’ve been at Microsoft now since July of 2015.

00:13:37 Okay. But like, working on this project.

00:13:40 I’ve been working on this project since Don joined the team. Join the company.

00:13:43 Okay.

00:13:43 So basically Don joined.

00:13:46 He and I were immediately put together, and we have been working on extension ever since.

00:13:50 All right, cool. Do you have fun with it?

00:13:54 Yeah.

00:13:56 It’s an interesting situation to be in because we have all these other teams getting to contribute. Right? As I said, we’re one large work group, but we have independent teams working on stuff and we’re at the integration point. So trying to work with other teams to get their stuff integrated and trying to stay up with the community with what they need and just trying to make sure we stay relevant and do well against Paul, Everett and PyCharm and everyone else who’s also trying to make editing Python as wonderful as we can.

00:14:26 Keep us on our toes.

00:14:31 Thank you, Config Cat, for sponsoring this episode. Config Cat is a feature flag service. It has a central dashboard where you can toggle your feature flags. Visually, you can hide or expose features on your application without redeploying. You can set target rules to allow you to control who has access to new features easily use flags in your code with Config Cat libraries or Python and nine other platforms. Get builds out faster, test in production and do easy rollbacks. Release new features with less risk, and release more often. With Config Cats simple API and clear documentation, you’ll have your initial proof of concept up and running in minutes. Train new team members in minutes also, and you don’t have to pay extra for team size with the simple UI. Even product managers can use it effectively whether you are an individual or a team. You can try it out with their forever free plan or get 35% off any paid plan with special code, test and code. All one word release features faster with less risk with configat. Check them out today at

00:15:35 Yeah. So I do need to formally apologize for mentioning that there is no way to add pipe test options within Vs code because there obviously is there’s two places so you can set it in the settings, right? Yeah, exactly. And I don’t know where I got I thought I read it somewhere in some tutorial that you can put options within the you can put the flags and you have to do it in the any file. I don’t know why I thought that.

00:16:12 Sorry about that.

00:16:13 It’s honestly probably easiest just because it’s tool neutral that way. Right. Like if you put your settings in your pride test Ini file, you don’t have to care about whether someone else on the team is using Vs code or not. Obviously, I hope they are, but it’s nice that if you can do it that way so that it’s tied more to the tool. The tool that you’re actually running versus the tool you’re using to run the other tool is probably the most portable. But yeah, we do have support in the settings to actually specify the exact flags you want pass to by test.

00:16:40 Yeah, well, I mean, if you want to advocacy or Zoom in on something by using a keyword flag to select the test or something like that, you’re not going to check that in.

00:16:56 So it’s good to have some other place. But yeah, there’s actually really come a long way. The testing support was a little actually maybe it was just me, but I was confused by it at first and now it is very clean and I like it.

00:17:17 Well, just to help cut your own Horn, Brian, your feedback was actually one of the big motivators for us to put some time and effort to clean it up. So I partially blame you.

00:17:25 No.

00:17:26 Well, good.

00:17:30 There’s a lot of cool stuff about it.

00:17:34 Okay, so I did some complaining earlier, but I’ll say the things that I love. I really like that when discovery is working as it’s supposed to, which is most of the time unless I’ve done something weird, the discovery ahead of time is pretty cool. So even with parameterization you can figure out which tests you want to run before you run it, and all the different selectors, you can just go down and select it.

00:18:06 The other thing that I just actually didn’t know this was here before, so I was just running some code earlier today. And the way when you look in the test browser part, there’s a little icon that you can just go right to the output.

00:18:30 What do I do before down at the bottom. If you ran a set of tests, you could go to the bottom and there was a little like at the what do you call that toolbar or something at the bottom.

00:18:40 The size bar status bar.

00:18:42 You could see the status of test and if you could click on that and say go show me the output. And that’s how I used to do it, which is definitely not the easiest way to get to the output. So it’s really kind of been becoming a lot of fun to be able to run different levels. And I don’t know right now how much is really lacking that it’s pretty great.

00:19:10 Yeah. Well, what happened was around the time you brought your feedback forward, we took a hard look at where our testing was, and we knew we wanted to improve it. And around that. Shortly before, I think Vs Code said that extensions could contribute to the activity bar, which is the far left column that has all the icons for search and the file Explorer and your version control view and all that stuff off. And they included a default icon for test and code. We decided, all right, well, this is a chance for us to kind of move away from the pure text output that we had previously and tried to give a better user experience.

00:19:58 On the episode with Paul, he painted Editors and Ides is kind of more or less kind of painting a visualization of these tools that you normally wouldn’t be able to get. And on Vs Code, we very much try to treat the extension as basically providing you visualization integration with your code from the tools you normally would run from the terminal. And so to really make it an improvement and worth more than just running pipes or unit test from your terminal, we realized we wanted a nice preview. And so what happened was Eric Snow, Fellowship developer and on my team, he ended up developing a Pi test plugin for test discovery. And then once we had that, we were able to get the hierarchical view. And that’s why, for instance, we can show you individual parameterized tests and actually have those execute individually versus running the entire test function that’s fully parameterized. Because when we run pytest Discovery, we’re plugging, we just see everything Python. So we just record that.

00:21:02 And when we had that, we just realized, well, we might as well just do a full tree and just do what people basically expect.

00:21:08 And then that led us to doing that. And then we saw the raw text output. Because obviously whenever you try to do a visualization over another tool, you want to get the basics down really nicely. But you don’t want to try to necessarily fit everything into a view because you will miss corners, pipest, updates pretty regularly and very well, which means there can be no stuff that we can’t get too fast enough. So we do kind of need that escape hatch to be able to let you see the output. As you said, we have a button. Now we’ll just pop up the output panel to show you the test output. So you can just see the raw output and be able to work with it as necessary.

00:21:43 Yes. So you also want to be able to see the trace back and stuff, or is that somewhere else other than the other?

00:21:50 No, we haven’t exposed that anywhere else. We’ve kind of just left that right now straight in the output window just to keep it simple.

00:21:57 Yeah.

00:21:59 Okay.

00:21:59 Well, it’s pretty clean anyway. I’m pretty happy with it right now.

00:22:05 The team will be very happy to hear that.

00:22:08 One of the things that confused me, because apparently I’m just easily confused.

00:22:17 I don’t know what the versions or the history, but there was a time where both Vs code and PyCharm were sort of like figuring out how to do virtual environments, whatever.

00:22:29 But now it’s for the most part gets it right if you stick a virtual environment. So I have the default of doing putting v and V or I know people that dot V and V. I think you’re a dot person.

00:22:44 I am a dot person.

00:22:46 So Vs code will like just if it’s in the top directory, it just figures it out.

00:22:54 I don’t know.

00:22:54 Yes. So the story behind that is on the extension, we try not to reinvent the wheel. We realize that for a lot of things there’s a pre existing tool in the Python community that people are already using and that it’s better for us just to integrate with other tools than it is to try to reinvent them. We don’t have our own formatter, we just let you use Black or Gas for auto Pepa. We don’t have a full on Linter that does style stuff right. Like our Language server will do some critical air detection for you. So you always have something. But like, we’re not going to run all the things up. Flaky and Pilot will tell you about like Camel case versus not and all that stuff. So we’ve always been a big believer in trying to integrate with the tools that are already there. Because of that, though, that does mean that you need to have the tools installed to be able to use them. Now, the interesting thing is some people install tools globally, and they always want to use that globally installed tool. Other people don’t want to have a specific version of a tool installed per project, right? For instance, Pi test. Let’s say Pi Test Six comes out and removes all the deprecated stuff in Pi Test Five that might not work for you because you may not have upgraded your test code or whatever to be able to run on by Test Six, so suddenly you’re potentially in trouble. So we try to reuse the tools as you’ve installed them.

00:24:17 Now, doing that, though, means you really want a virtual environment, because if you do a global install, it’s not going to be what you want necessarily. So as an extension, we try to move people towards the concept of virtual environments, which means we’ve had to make sure that when you say, hey, I’ve set it up for Python, we have to help you install it. But once we help you install it, we want to make sure you do the right thing. And in that case, that’s the virtual environment. So we’ve had to set up the code such that we watch your workspace and as soon as the new directory is at the top level, we check. Is there Python. Cfg file? Oh, there is. Okay, well then we can notify you that hey, we noticed you’ve created this new virtual environment. Do you want to use it? Yes or no. And that way we try to make it as smooth as possible because we think virtual environments are a very good thing, but unfortunately are not known as widely as we’d hope. At least I personally would hope.

00:25:03 Yeah.

00:25:03 And so this is just one of the ways we’re trying to kind of move that boat forward. We have bigger plans to try to help people with set up and stuff, but that’s kind of farther down the road.

00:25:11 Yeah.

00:25:13 I have a disagreement with I know that there’s some people that teach Python that think that you should not introduce virtual environments right away because it’s just an extra confusion thing.

00:25:25 My reason for disagreeing with that is I think a lot of people get about an hour of training and then leave and just go run with it.

00:25:35 So it’s kind of important to get that.

00:25:39 In fact, I think my opinion would be it’s okay to start people off in the reple and launching little bits of code that only use the standard library initially. But as soon as you start to teach people installation and you teach people how to use Pip or something, that’s when you should immediately teach people virtual or Range, in my opinion. I do realize that it is an extra thing and it is extra cognitive overhead. But as you said, I’ve been in those tutorials, right, where you spend a day teaching people something and they will very easily leave and walk away and go do things. And like a lot of people, if you know enough to be dangerous and just to get stuff done, you will stay dangerous getting your stuff done. And you won’t necessarily take the time to learn more of what the next thing to do is because you might not know. Right.

00:26:26 If you learn Python for a day and you get far enough to learn how to use Pip but you haven’t learned virtual environments, how would you even learn about virtual environments? Unless you decide to expand out and read more tutorials or a blog post or who knows what to happen to mention that these virtual environments exist and why you should use them. Otherwise, you could very easily go for the rest of your days just blowing out your global install of Python and installing a ton of random stuff and not understanding why that’s a problem. And when that day happens, having a mess of a time trying to clean up your installation or figure out what went wrong.

00:27:00 So I think at least there should be a passing mention as soon as Pip mentioned, it’s like, hey, we might not be coming today, but do learn what virtual environments are. If you’re going to do any serious work because it’s going to save your life at some point, and it’s totally worth the overhead of learning it. And so I understand not be able to fit it in necessary, but I would definitely not let people leave knowing how to use Pip without also knowing that at least virtual environments exist.

00:27:25 Yeah, I think that’s a good idea.

00:27:30 Thank you, Pie Bytes, for sponsoring this episode. I’ve been a fan of Pi Bytes code challenges for a long time. It’s a great way to practice Python and get better every day. I really love the learning paths where you can choose different aspects of the language you want to learn and do a series of related challenges. Bob and Julian, the people behind Pi Bytes, have also started doing something cool to help people level up with Python. They’re trying to help people with career paths and career coaching. Very cool. You can go to Pie Bites and under Services. Check out Coaching. There’s also a link in the show notes. If you not only want to get better at Python, but you want to focus your efforts in a way that advances your career, consider some coaching from Brahma Julian. At PieBites, the pytest flags, you can get to them, but it’s up in the settings. Well, right away, if you open your project and Vs code is not seeing your tests, you do like, I don’t know how to get it. Otherwise, it’s like the Control Shift P or something.

00:28:32 Yeah, Control Shift P or Command Shift PC.

00:28:36 Okay. And you bring up that setting stuff and you can type test and you’ll get to the configure test or something.

00:28:46 So there’s a couple of ways to do it. So one is if you bring up the command palette, which is the Control Shift P thing. Sublime Text users are probably very familiar with this.

00:28:56 You can run Discover tests and if you have never configured testing, we will prompt you saying your tests are not set up. Would you like to? And then what we’ll do is we ask you which test runner do you use? Py test or unit test? We also have no support, but it’s kind of honestly just sitting there since no, it’s not really supported on its own.

00:29:16 And then on that we ask you a couple more questions. So if you do Pi test, for instance, we ask what directory do your test live in? And then we will write out the settings for you. The other option is, as you said, you can just open up your settings once again, easiest ways through the Command palette, just type settings and then you can open your user settings or your workspace settings. And then in their base you’re almost like going to put in your workspace settings because that’s going to be tied to your project. What your settings are. You can manually do it either through the UI or honestly, that’s backed by a JSON file that you can directly edit as well, and you can just add the JSON keys.

00:29:51 Honestly, I always use the JSON, but that’s just out of habit because I’ve been using vs code long enough. I predate the UI.

00:29:56 Okay.

00:29:58 I didn’t know I can get the settings through the command palette.

00:30:01 Everything is through the command palette. The entire system is designed to be run through the command palette.

00:30:07 I think that’s one of the reasons vs code is really caught on with some of the more Unixy folk who used to be like hardcore Vin users and not so much users. Those people are special.

00:30:19 I get to say that because I know Barry Warsaw personally, but we’ve had a lot of Vim converts because the vim plugins. The vim extension for vs code is really good. And a lot of people love the Vin bindings, but they wanted a more UI I based editor in terms of just like actually having a file menu kind of thing.

00:30:38 Yeah, I probably would have tried this first if Sublime wasn’t around.

00:30:42 Yeah, exactly right. And I used to be a Sublime user before I joined Microsoft and vs code became a thing. I was totally a Sublime user.

00:30:49 Yeah, the Vim findings are great, actually.

00:30:53 And I kind of forget that everybody doesn’t use vim findings everywhere.

00:31:00 It’s an acquired taste, but once you’ve acquired it, it’s hard to get rid of.

00:31:03 I do like also, I guess while we’re on that topic, the GQ works correctly in vs code.

00:31:10 Yeah, it’s really surprising how good the support is in that extension.

00:31:17 So tell me the settings tell me that there are two kinds of settings, right?

00:31:23 There’s user and what’s the other one?

00:31:26 So there’s technically three, but it’s easier to think about it in terms of two levels. So there’s user settings and there’s workspace settings. So user settings are literally the settings that you as a user want for the editor itself. This is stuff that transcends any of your code that you use. So this is going to be like what your preferred font is, that kind of thing. And then you have workspace settings, and those are tied to the folders that you open in the editor that’s your workspace. So if you were to open Brian’s cool testing project, you would have workspace settings in there that would differentiate from Brian’s crazy idea workspace so that you can have like pytest settings here that you want for whatever reason for just that workspace, and you can have separate ones for your other workspaces.

00:32:19 So that’s the key difference. It’s basically things that apply to the editor no matter what code and what directory you have open. And then things are basically directory specific which are per workspace. Now there is a middle one.

00:32:31 Vs code has the concept of multi route workspaces, and probably people who have done micro services probably know what I’m talking about, where basically you can have a workspace file. And what you can do is you can open multiple directories in a single workspace and each of those individual directories can have their own settings as well. But you can also have an overarching one. So if you have a micro service architecture, right, and you need to open up, let’s say two or three different microservices that you’re working on, you can create a single workspace that has three other directories tied into it, and then you have one set of settings that covers all three directories on top of individual settings per directory, like in the extension. For instance, if you open a multi route workspace, we actually will try to flip around what Python environment you selected based on which file you open in which directory. So you can have directories a, B and C all in one workspace in a multi route workspace. And if you have a set to price on 36 and be set to 35 and C set to, God forbid 2.7, we will flip around the environment as appropriate. As you look at those files.

00:33:37 How do I get to a multi route workspace? Is that.

00:33:42 If I remember correctly, you can literally just open a folder and then I think there’s a way to just add another folder and then it will make it into a mobile workspace. There’s also open workspace as an option. And basically you can just choose a directory where you kind of want the settings to live and then that’s really all it is, literally a workspace file. I think there’s another part of the file name and then that will map in your settings, plus what directories are part of that workspace. So if you just open that file, it will actually pop open in your file, explore all those individual directories that are part of it.

00:34:17 It’s more cool than I knew before, so that’s neat.

00:34:21 Yeah. It’s also really handy too.

00:34:23 Even if you have a single project that has just multiple little parts to it. Like in the extension we have a multi work space that will open up like separate sections because we have some little tools written in Python, it will actually open those up as a folder at the top level so that they operate as if they’re a top level thing, even though they’re embedded in our folder structure. So it can be really handy. It gets a little complicated in terms of support just because you’re jumping around. They’re kind of isolated things, but they’re being viewed at a higher level, but when you need them they’re really handy.

00:34:54 So one of the questions I have is how do they combine so the flags and stuff or the options.

00:35:07 At the API level VSCO can let you either just ask for the setting and do the resolution or I believe you can actually ask at what level you specifically want to setting.

00:35:17 I believe workspace settings Trump multi route workspace settings, which Trump user settings. So pretty much the way you would think the more specific ones.

00:35:29 Okay. But they don’t combine.

00:35:32 No, they’ll map over each other like it’s a flat view. So at the API level, what you so like, for instance, setting your Pi test setting, that would be Python dot testing, dot pilot ARGs. Right. For flags to pass the Python in the API, we just literally say, okay, from the Python testing namespace, give me pytest. Args. And then it just works its way up the tree of settings to just find out where it is. And you can ask later, like, okay, where did you get this from? Can you tell me what scope and I’ll tell you what this is workspace or this was user or whatever.

00:36:08 Usually you don’t need to care.

00:36:12 For instance, I can’t put in for parallel testing and dash V or something at my user settings, but then also put keywords at the workspace settings.

00:36:31 No, there’s no merging of the exact same settings. No. So the one you put at the workspace level will Trump the ones that you use your level. So basically we could, as an extension, try to make that work.

00:36:46 That’d be kind of messy, so probably not.

00:36:50 So I’m not going to say we plan to do that ever.

00:36:54 You could try to convince us otherwise, Brian, but yeah, we don’t try to merge arrays across the same setting at different levels.

00:37:03 No, I actually think that’s good, because the weird use case that I brought up might make sense. But what’s probably going to happen is somebody sets the flags and it doesn’t do what they expect it to do, and they’re like, what the heck? And it’s because there was the other one set or something. Right.

00:37:19 And then you have to think about, oh, well, could it be one of my settings? And you’ve got to open up all your settings to scale back up and like, well, it’s not my user settings, it’s my workspace settings. Now, luckily, the settings editor has a toggle at the top where you can jump between two tabs that show workspace and users. So it’s pretty easy to flip back and forth. But you still got to think about that and know that that’s there and trying to debug. That would not be fun.

00:37:41 Well, it messed me up. I’m like, it’s not working because I had set user settings once before, which I didn’t expect to just live on forever because I just didn’t understand user and workspace settings before.

00:37:55 It makes sense for some reason.

00:37:58 I don’t know. Yeah, workspace. Workspace is like a project then.

00:38:03 Okay, cool.

00:38:05 One of the really interesting thing about settings that I don’t think a lot of people know is at least as an extension, we can flag which of our settings are machine specific.

00:38:13 So I don’t know if you use containers or anything at your work, but Vs code has really good remote development support, so we can actually flag, you can set the path to pilot if you have a global install. But we have that flagged as a machine setting. So if you have that set in your user settings on your machine, it actually won’t propagate when you connect remotely into a Docker container or WSL and run your tools that way because it’s considered tied to your machine. So even though you have it set as user setting, if you do a remote connection to another machine, it won’t propagate it over. Knowing that it will apply over there, it won’t make sense. So the setting system is actually pretty impressive in vs code.

00:38:52 So I can use vs code to edit like a Linux Docker image or something.

00:39:00 Okay.

00:39:00 It’s very slick, actually.

00:39:03 What vs code basically does is if you’re pointing out a Docker container, what it will do is we’ll use Docker compose and it will layer on a headless vs code server and run a vs code server in the Docker container on your behalf and then connect to that headless container. So basically it’s kind of like vs codes take on X Eleven. Almost. Right. So on your machine you’re going to have all the UI stuff, but all the commands and all the executions actually get to be occurring on the Docker container through the headless server.

00:39:37 Okay, got you. So everything’s nice, fast UI and everything. But you get all the proper like, the terminal is going to be in the container, the settings are going to be in the container. And based on that machine, all the view of everything that has any impact is going to be actually becoming out of the container while the UI is still just running locally on your machine.

00:39:55 So it just works how I expect it would work.

00:39:59 And I don’t have to care about all the work that went in to make that simple.

00:40:03 Exactly. And it works for containers, it works for WSL and actually works for SSH as well.

00:40:08 And it’s really popular with Python users, apparently.

00:40:12 Well, yeah.

00:40:16 What would people use it for? I don’t know, lots of stuff.

00:40:20 So any cool things that I might not know about that you think are neat within vs code or Python versions?

00:40:30 Actually, our debugger is really good. We actually contract with Fabio of Pydevd.

00:40:37 He actually does a lot of contract work with us. So we’re able to get a lot of the bug fixes into Pydevd as necessary. And that actually does trip, I assume, trickles back up even to Python, because I know they use Pi DEVD as well.

00:40:50 But the debugger supports really good.

00:40:53 For instance, we have one crazy feature Be blogged about in February that we thought not enough people knew about. So we actually explicitly called it out because they actually landed a couple of months before we support for something called Jump to cursor. So let’s say you’re debugging and you hit a Breakpoint and you go, okay, this isn’t looking quite right. I want to try this again, try this chunk of code again. But I want to change like a setting. So what you can do is in the variable editor, in the variable view, you can go in and manually change the variable and then you can say jump to cursor and you can actually right click choose jump to cursor and execution will jump to that line in the code and then just continue on. So it’s actually a debugging go to.

00:41:36 Okay, it’s not just setting a Breakpoint and then running to the Breakpoint.

00:41:40 Basically it is. But in Python, right. You got to remember, at least in C Python, the interpreter, the way execution works is you have an execution frame and the execution frame says I’m executing this file, I’m executing this by code at this position. Right? So what we can do is in the execution frame, we can actually change those values to say, all right, we’re no longer executing at that line. We’re actually now executing at that line. And then the interpreter doesn’t know any different. So it just goes to the next line.

00:42:10 So we’re able to through the UI actually cause you to jump to a whole other position. You can actually jump outside to a whole another function in the middle of it.

00:42:20 So you’re not running all the stuff in between. You’re actually just changing where you’re executing.

00:42:25 Oh, wow.

00:42:25 Which can be really funky and cool. If you’ve been having a long running process or spend a lot of time Loading like really expensive data, scientists have come to us going like, how can I make this load faster? Because I have to spend ten minutes Loading this data set. And other than the usual trick of like we’ll preload and just try to pickle it or store it somehow temporarily. So the load times loads the data load. Not having to hit your database to run a query. The other way to do it is run it, hit a Breakpoint, and then if you need to tweak something, tweak it in the variables view or whatever, and then just use the jump to cursor back to where you want it to go to see the result of if you run that code again with those different values and that way you don’t have to rerun all your startup.

00:43:05 Oh, that is cool.

00:43:07 Yeah.

00:43:08 It’s hard to hard to get in a little tweet, though.

00:43:12 Yeah.

00:43:14 If you go to our blog JK. Mspythonblog, if you go to the February blog post, we actually talk about it and there’s a little gift that will make it a lot more apparent.

00:43:26 But it’s just one of those cool little things that you just don’t know about unless you just really dive deep into the tool that you’re not going to need every day. But when you need it. Oh boy, is it handy.

00:43:36 So what’s in the future for the Python extension?

00:43:42 There’s a lot of things, unfortunately, that I can’t talk about as of right now. Lately we’ve been doing a lot of work on our data science support, so we support you for notebooks, and we have an interactive window and all that kind of thing.

00:43:55 We have both of you that’s much more like a notebook, and we have this interactive window approach as well, where you have the editor and you have the execution cells on the side. So it’s not a full blown notebook experience, but in terms of the markdown and all that in between.

00:44:10 But you get the full editor view of. Yes, code and sell execution of highlighted code and getting to see the result and work that way if you want.

00:44:17 We’ve been putting a lot of work in that. There’s a lot of work happening behind the scenes on the language server can’t talk about, but people should be looking forward to when that comes out.

00:44:27 And then we got some other things that we have some ideas on. Once again, Unfortunately, I don’t like talking roadmaps because it’s one of those things. As soon as I talk about or give dates, everyone starts to hold you to it. And I don’t want to put that on my team or any of my teammates.

00:44:41 But we got stuff coming. We do release monthly, so it’s easy just to read the blog posts every month written by our wonderful PMS, especially our main P. M. Luciana. And you just keep on checking out and see what we’re cranking out.

00:44:55 Yeah. Okay. The specific stuff I get, but it does make sense that it seems like you can kind of say, well, we’re kind of focusing on more data science stuff for a while or don’t hold your breath because there aren’t going to be any new test stuff for a long time.

00:45:12 So what I’ll say is right now the focus so data science is doing their thing, the language servers doing our thing on our side. As of right now, you could say we’re kind of focusing on the first five minutes of the experience.

00:45:25 I think that’s great. That’s getting set up on, getting your virtual environment set up, getting the editor up and running, and just getting you kind of set up in your experience.

00:45:37 That’s what we’re probably going to be focused on in the short term.

00:45:40 Okay, nice.

00:45:42 And then I rushed by it briefly. But you can run XR to do parallel testing. Does that work with them? Yes. Okay.

00:45:59 Yeah.

00:46:01 Cool.

00:46:01 I think she even mentioned in our docs.

00:46:04 Yeah.

00:46:06 The docs are the manual. Who reads that?

00:46:08 Yeah. Oh, I know.

00:46:10 I’m currently the person who answers all the questions on Stack overflow for the extension.

00:46:17 I understand people don’t read the manual.

00:46:19 The long history of everyone.

00:46:22 I’m very used to it. It’s unfortunate, though, because we actually have really good tech writers that help us with our documentation. So it’s actually not being written by us. Our tech writers do a great job writing for us, so actually pretty high quality. So I honestly wish people would read them a bit more because they’re really well done.

00:46:39 Okay. Yeah. And I don’t mean to diss anybody like that at all.

00:46:43 No, it’s fine.

00:46:45 As we were talking about earlier, it’s very easy to just learn enough to be dangerous and get going. And there’s not ever take the time to learn more because it’s time. Right. We only have so much of it, and so it’s not necessarily a priority to want to sit down and read documentation from beginning to end.

00:47:00 Yeah.

00:47:01 When I was playing around with Vesco this morning, it told me that I’m doing a lot of markdown files. I should probably download Markdown Lint, and that’s an extension that looks pretty cool. And it just told me how horribly formatted my markdown was.

00:47:20 Thanks.

00:47:21 The other thing is okay, so one of the things I was a little confused about is the little testing beaker that shows up, or whatever that’s called.

00:47:30 What causes that to show up? Because sometimes it doesn’t show up right away.

00:47:34 Yeah. So I’m going to say it’s a little complicated because we run experiments in the extension. We try to be a very data driven team. So we try to do things based on what our users actually ask for, either implicitly or explicitly, based on what features they use in the extension or what they explicitly ask on GitHub. Like, we actually pay attention to the up and down, the thumbs up and the thumbs down on issues, on what to prioritize. And one of the things we’re trying to experiment with is what would happen if we always showed the beaker.

00:48:11 Technically, by default, we only showed if you’ve configured testing because we try not to clutter your review.

00:48:18 If you’re not going to use this to run tests, which is totally fine, we don’t want to take up valuable space in the activity bar, so we don’t show up. But we do have an experiment where we do show it consistently.

00:48:27 If we have any signal at all that you have tests, we show it and just like it’s there, it won’t be populated. You’ll have to discover tests, but it will show up. So as of right now, it is one of the sticking points we’re trying to figure out is how to help it’s discoverability of our testing support and how to get more people to use it.

00:48:49 So that’s what that experiment is about, is trying to figure out ways to try to get the word out more or less while you’re using that, because as we’ve just discussed, not everyone reads the docks, which is totally fine. So we have to figure out a way to kind of expose these things to people who have not read the documentation and notice that we have testing support.

00:49:05 Okay. So if the beaker doesn’t show up and you don’t know why, you have to configure you go configure the test.

00:49:11 Yeah, literally just run the command discover tests and it’ll just walk you through setting it up and then it’ll show up.

00:49:19 Once the settings are set, we’ll just notice that you have settings set for it and we’ll assume you want to do whether the test discovery succeeds or not. And then from there it’s just the exceed or you see what the failures are and try to fix your tests because sometimes test discovery just doesn’t work.

00:49:36 Yeah, the thing that I know that consistently breaks it and I don’t think it’s just normal. There’s a lot of imports happen when you’re doing test discovery and so if there’s syntax errors in your Python code, in your test directory, discovery gets broken.

00:50:00 Yeah, I do the exact same thing. If I’m typing something out and I habitually save in the middle of typing something and I’m not syntactically valid Python, it’ll blank out the discovery because suddenly there’s nothing to discover because pytest throws a syntax area like well, I can’t analyze this source to figure out where all the test functions are. It’s not even valid Python code.

00:50:22 Yeah.

00:50:22 Okay, cool. Well, thanks for all of that.

00:50:27 Of course. Anytime.

00:50:28 And we’ll talk to you later.

00:50:30 All right, talk to you later.

00:50:35 Thank you, Brett. Thank you for your work with vs code and with Python and it’s always fun to have you on the show. Thank you for sponsoring conficcat featureflake service lets you release features faster with less risk. Thank you pie bites for sponsoring check out their Python career coaching and take your career to the next level and thank you listeners that support the show through Patreon join them by going to support of those links and the links to items we talked about in the show or in the show. Notes at 1117 that’s all for now. Now go out and test something.