You know the two questions I ask at the end of each episode?
What's your favorite editor for writing Python code?
And what less well-known PyPI package do you recommend?
Well, this time, we're going to make an entire episode out of
what's your favorite editor.
You'll meet Don Jayamane, who created the wildly popular
and open-source Python add-in for Visual Studio Code.
That's not the Windows-only Visual Studio,
but Microsoft's free cross-platform editor.
This is Talk Python to Me, episode 101, recorded January 23, 2017.
Welcome to Talk Python to Me, a weekly podcast on Python,
the language, the libraries, the ecosystem, and the personalities.
This is your host, Michael Kennedy.
Follow me on Twitter, where I'm @mkennedy.
Keep up with the show and listen to past episodes at talkpython.fm
and follow the show on Twitter via at Talk Python.
This episode is brought to you by Talk Python Training and Hired.
Be sure to check out what we both have to offer during our segments.
It helps support the show.
Don, welcome to Talk Python.
Hi, Michael. It's a pleasure to be here.
It's great to have you here.
You know, we're going to talk about Visual Studio Code.
And I know Visual Studio and Python,
while they do have the Python tools for Visual Studio,
that's not what we're talking about.
Typically, people think of Visual Studio as this thing being a Windows thing,
and mostly for like .NET and Windows C developers and so on.
But what we're going to talk about is a really amazing plug-in or extension
that you've created for Visual Studio Code,
which is actually a cross-platform editor based on JavaScript,
that Microsoft has released.
So we're going to talk about a pretty excellent Python editor
that you've had a lot of influence in creating.
Yes.
This is a little project that I've worked on.
And as you mentioned, Visual Studio Code is not Visual Studio IDE
that's been developed for Windows.
Most people think it is, but it's more of a cross-platform editor.
Yeah, it's really, really nice.
And it's gaining so much traction.
And the Python tools you built were really cool.
So I want to talk about those.
But let's do first things first.
Let's hear about your background.
How did you get into programming in the first place?
Back in 2000, that's when I started a course in computer science.
And I was looking for a permanent role in permanent part-time role
in information technology.
And that's when I joined a company named EDMS.
It's basically a branch of a company in Australia named QA Software.
The way they hired people was they just took kids just after year 12.
And you were given an IQ test.
If you did well, you were hired.
So they hired me.
That's a really interesting way to get a job.
They're just like, look, we know you're smart.
You're driven.
And we think we could teach you programming.
Yes.
So it was a really great place.
And as the name says, QA Software, it stands for Quality Assured Software.
So they were really keen on ensuring the programmers were thought the very basics on programming.
That was writing unit tests, writing technical specifications, and writing quality-issued code.
So it was really great.
It had a very great foundation.
And I started learning.
I started programming with Visual Fox Pro.
Again, I don't know if many people know about that language.
It was...
Yeah.
You know, actually, I don't know if they do.
So it's kind of like an access sort of language for databases, right?
Can you maybe tell people what that is?
Yes, that's exactly right.
It started out as Fox Pro.
And then, if I'm not mistaken, Microsoft bought it over and turned it into Visual Fox Pro.
So initially, they had Visual...
I think it was Visual Studio 5.
And then they added Fox Pro onto it.
And then it became Visual Studio 6 because it became one of the six little components to Visual Studio.
Eventually, they killed it off.
Yeah, it's not a thing anymore.
But yeah, it was a big language.
Oh, yes.
For sort of rapid development, right?
Oh, yes.
Personally, I thought it was better than Visual Basic.
So...
Okay.
Yeah, yeah.
Very interesting.
So where'd you go from there?
From there?
So I stayed there for a couple of years.
And eventually migrated to Australia in 2004.
And so while I was at that place that we were using .NET as well.
So once I migrated to Australia, then I was just using .NET primarily.
And .NET and SQL.
Yeah.
All right.
Interesting.
Those are a long ways away from Python.
So what got you into Python?
Simple.
It was the Raspberry Pi microcontroller.
Or I don't know what it's called exactly.
Or microcomputer.
Once I heard about the Raspberry Pi, I just wanted to get my hands on one of those.
And I learned that the best language to work on Raspberry Pi was Python.
And I figured that was a really great excuse or great reason to learn another programming language.
And yes, that's how I learned it.
Yeah, that's really nice.
Did you end up building anything interesting or just sort of play around with Raspberry Pis?
Initially, I just started playing around with it.
But my first project was building a little timer slash remote for my pool motor.
Because I had just moved in.
And the pool pump wasn't...
It had to be turned on manually.
The timer wasn't working.
So I had to hook in the Raspberry Pi with a timer.
And that would turn the pump on and off late in the night.
Nice.
Did you internet enable it so you could see the status of it or anything?
Oh, no, no, no.
It was just a timer and then just turned the pump on and off.
And I was just happy with that.
That's really cool.
I love how you used it to solve a real world problem.
You're like, you know what?
I can program this silly pump.
And so there were times when it would...
There's a little thing called a creepy crawly as well.
It would get stuck or tangled up at night.
So this was just the early days.
I didn't know how to look after a pool or maintain a pool.
So I'd even hooked up a camera to this so I could see in the middle of the night whether it's functional or whether it's stuck somewhere.
And yes, that's what I did.
I don't have any of those things anymore, but it was just in the first couple of months.
Oh, that sounds really cool.
How did you find learning Python to be?
Did you pick it up pretty easily?
Yes.
Amazingly really simple language.
Initially, the only thing that I found annoying was the indentation.
So blocks of code had to be intended.
So coming from other languages, I just felt that was a little weird and took me, I guess, a week or two to get used to that.
I just felt it was...
Initially, I thought it was a poor language having to do that.
But over time, I realized it was a really very powerful and very, I would say, a very cool language.
Yeah, that's really cool.
I had a similar experience.
I think a lot of people who come from C-based languages where blocks are curly braces and parentheses and things like that.
I just...
You're so used to white space not mattering.
That it's really...
It catches you off guard and you're like, wait, that's crazy.
But once you realize that editors really, really help you, they kind of make that almost transparent or invisible and they manage it and you don't have to.
Well, then all of a sudden, it's pretty sweet once you get your mind around it.
I absolutely prefer that kind of programming now.
But I remember it being a bit of a mind shift the first time I saw it, too.
Interesting.
Okay, cool.
So let's talk about Visual Studio Code and your plugin.
We mentioned a little bit about Visual Studio Code.
It's built on something that I actually am a fan of.
It's this thing called Electron.
So can you maybe give us the history of Electron and its maybe weird intersection with Microsoft?
Electron started out as a project that...
What's this GitHub word called?
Yeah, GitHub, I think, yeah.
They started out...
It didn't start out as a standalone project.
Initially, they built...
To my knowledge, they built Atom.
And then they realized, hey, wait a minute.
We've got this really cool framework that can build desktop applications.
And from there, they took out parts of Atom and built Electron.
So basically, if you would look at it, Atom is built on top of Electron.
And so for some time, people had been using Atom to build extensions.
And basically, that turned into an editor.
Microsoft came along and they realized, oh, we could do the same thing because we need to provide an editor for C# and a couple of other languages as well.
So they came in and took Electron as the basis for Visual Studio Code.
Yeah, that's interesting.
I mean, it used to be called even Atom Shell, right?
Before they were like, okay, it needs its own name, right?
Which is really interesting.
You know, I guess the origins...
It just seemed really weird to me that Microsoft, the company, is coming along and shipping one of their major new projects on Chrome and Node.js.
It does not think like where...
It's not where I thought they would be focusing, but it's a cool thing.
Yes.
It's interesting that you mentioned Chrome and Node.js.
For people who don't really know what Electron is, the best way to describe it is it's a desktop application built using Chrome and Node.js.
So again, if people don't know what Node.js is, it's just JavaScript.
That's pretty much it.
Yeah, it's interesting.
And it packages it up and you just get like a .app on your Mac or whatever and you could care less or you don't really know that it is unless like you actually know the internals.
And one of the things you said was interesting was how it makes like heavy use of extensions to give it any functionality.
Yes, that's Atom.
Atom uses a lot of extensions.
Basically, there's not much built or baked into the extension apart from the editors.
This is where Visual Studio Code differs significantly.
Microsoft came in and they had the benefit of hindsight.
So they could see where Atom and Sublime had their drawbacks and they built Visual Studio Code to resolve those issues.
For instance, Atom had some serious problems with editing or loading of large files and Visual Studio Code did not.
One of the major reasons for people adopting Visual Studio Code was because of its efficiency in dealing with large files.
Yeah, and if you had to categorize it in sort of its size on one hand and sort of the, I just run it in the terminal, very lightweight.
We've got things like Vim.
We've got sort of middle-sized, I guess, tooling like Sublime Text.
I guess maybe throw Atom in there.
And we've got heavier weight things that do many, many things but are quite large applications like PyCharm or Wing IDE or Visual Studio even itself.
Where do you think Visual Studio Code falls in this category?
Somewhere halfway there.
I would say in the middle because of its debugging capabilities and integration with the Git and a couple of other capabilities.
So it's a very mature and very capable editor.
So I would have to say it's definitely halfway there.
Sure.
Okay.
Yeah, I mean, it seems like Sublime Text but a little bit larger in terms of size but not a full-blown IDE and maybe in like how it feels when you work with it.
That's correct.
Yes.
Okay.
So people may be wondering, what's all this about on this Python show?
But let's talk about your Python plugin for Visual Studio.
And it's just called Python for Visual Studio Code, right?
Yes, it is.
Yeah.
And when I first saw that, oh, cool.
Because, you know, when I first started playing Visual Studio Code, it didn't support Python.
And so, like, the white space indentation was not working right.
And I'm like, oh, this is not going to work.
Put that away.
And then I checked back.
I talked to some of the guys that mentioned it.
And I'm like, oh, let me have a look at this.
And then I found your plugin.
I'm like, wow, this thing is actually really rich and nice.
So, first of all, let's start by how many downloads does it currently have?
Before that, how old is it?
It's a little over a year old.
If I remember correctly, I started work on this sometime in late 2015, somewhere around November or December 2015, late night to early mornings of December 2015.
So, it's just over a year old now.
Okay, cool.
So, now, with that in mind, how many downloads does it have?
It's got over a million downloads.
So, if I were to be a bit more accurate, maybe 1,150,000 downloads.
So, yeah.
Yeah.
That probably, that number is climbing.
And that's just, you know, that really got my attention because I'm like, wow, you know, how many people really use Python and Visual Studio Code?
Come on.
And then I realized this is like the second most popular extension or something.
And it's really, really used.
And as I looked into it, there's a lot of features there.
Yes.
As you mentioned, it is really surprising.
Surprising because, one, it's, this is a Microsoft product, Visual Studio Code.
And the most popular extension is the C# extension.
So, one would have expected the next most popular one to be something to do with, I don't know, maybe TypeScript or something else.
However, it's Python.
So, it just shows that Python is really up there in terms of popularity with language.
To me, it was something very new.
That's not what I was expecting at all.
Yeah.
That's really surprising.
Yeah.
And there were others in the community, too, who were really surprised to see, hey, Python's really doing very well.
It's really interesting.
Yeah.
That's, it must have felt really good to put out something that got over a million downloads.
And you have over a million people using it.
That's amazing.
Yes, indeed.
So, what got you, you said back in late 2005, you started working evenings and, you know, skipping sleep and stuff.
What got you started?
Like, why are you like, ah, this thing must exist.
I have to create it.
Were you like me?
You're like, I wish this would, like, indent my code correctly.
But you actually took some action and made something happen?
This is, I would say, I was primarily looking for a really cross-platform editor.
Where is it?
Cross-platform.
I was working, I was using a Mac at that time.
I was learning to do some development on a Mac.
And Windows as well.
So, I was still working on Raspberry Pi.
As I was jumping between the two platforms, I wanted a consistent look and feel for the editor.
So, PyCharm was the only one that fit the box.
However, as a Visual Studio developer, someone who's been using Visual Studio all my life, I just preferred that look and feel.
So, though PyCharm was great.
I still preferred something else.
I guess, in the back of my mind, I was still hoping for something from Microsoft.
And when Microsoft released Visual Studio Code, I was using that as a replacement for Notepad++.
When they released that, I was really looking forward to them providing the API for developers to build extensions.
As soon as they did that, I thought to myself, oh, this is a great opportunity.
Let's just provide an extension for developers, at least myself, who can use it to edit Python files on both a Mac and Windows.
And I was also looking for a really simple project to work on while I was at home using Node.js because I wanted to play around with Node.js.
So, I was looking for a project to work on.
Right.
So, obviously, the tooling is for Python developers, but what type of code did you write to create this thing?
I'd say primarily Node.js.
So, it was really like writing almost like an Electron app, right?
Yes.
Yeah, okay.
That is correct.
So, if you want to write any extensions for Visual Studio Code, you've got to do it in Node.js.
So, Node.js is the framework.
The language is TypeScript.
So, TypeScript is a language that Microsoft have developed.
It's basically a superset of JavaScript.
So, those who don't know what TypeScript is.
Right, like adding static typing to JavaScript in a sense.
A little bit more, too.
Precisely.
Yeah.
Yes.
That's right.
Okay.
Yeah, interesting.
Interesting.
So, you talked about PyCharm.
You said there was Sublime.
Like, what...
Why didn't you pick and just go like, oh, let's use Sublime over here.
Like, that works on both platforms as well.
For some reason, I never did like Sublime.
I don't know.
I guess it's just the font and the way the IntelliSense was displayed.
I don't know.
As I mentioned, as a Visual Studio developer, the look and feel was completely different.
So, I preferred the way Visual Studio laid things out.
Whereas Sublime, I was still getting used to using editors.
PyCharm was an IDE.
Sublime was an editor and it just didn't feel rich and powerful enough to me.
So, it was just preference.
All right.
Sounds good.
So, your project, when I first talked to you, it had over 600 stars on GitHub.
That's a pretty serious project.
Yeah.
635.
So, what's it been like to...
And all the code for this is on GitHub, right?
Yes, it is.
Yeah.
Okay.
Cool.
What's it been like to run a project with that much popularity?
Have you been getting a lot of feedback from the community or people helping out?
Oh, yes.
I've been getting quite a lot of feedback.
And, like, for instance, plenty of people provide the feedback while submitting issues on GitHub or maybe on the extensions page.
And it's very humbling to know that this little pet project of mine has made a big difference in the development experience of people in the professional workspace.
So, for instance, when people say that they've switched over from Sublime or some other IDE because of Feature X, Y, Z, it feels really great.
And there are others who talk about the efficiency of the extension or they say that they love Visual Studio Code.
And for me, it's a person who just loves Microsoft products.
I'm like, oh, wow, this is really good.
Something Microsoft has done really well and is finally doing well.
Yeah, it's definitely interesting in that they seem to have given up on the idea of, like, the answer is always a Windows.
Now, what's the question?
You know?
And just trying to be more part of the community.
And I think this is one of the places where we're starting to see some cool things out of that.
This portion of Talk Python is brought to you by us.
As many of you know, I have a growing set of courses to help you go from Python beginner to novice to Python expert.
And there are many more courses in the works.
So please consider Talk Python training for you and your team's training needs.
If you're just getting started, I've built a course to teach you Python the way professional developers learn by building applications.
Check out my Python jumpstart by building 10 apps at talkpython.fm/course.
Are you looking to start adding services to your app?
Try my brand new consuming HTTP services in Python.
You'll learn to work with RESTful HTTP services as well as SOAP, JSON, and XML data formats.
Do you want to launch an online business?
Well, Matt McKay and I built an entrepreneur's playbook with Python for Entrepreneurs.
This 16-hour course will teach you everything you need to launch your web-based business with Python.
And finally, there's a couple of new course announcements coming really soon.
So if you don't already have an account, be sure to create one at training.talkpython.fm to get notified.
And for all of you who have bought my courses, thank you so much.
It really, really helps support the show.
So how many contributors are working on the project?
If you were to look at the total number of contributors, I believe there are around 200, sorry, 29 contributors.
Okay, cool.
And do you have the concept of a core development team?
Or are you just managing it yourself among all these people?
Or how does it work?
Unfortunately, it's just myself.
So the other contributors just contribute maybe some of them just fixes or typos here and there.
And I would say the major contribution has been something like adding a new linter, for instance, adding prospector to the extension.
So it's just here and there.
But I have to acknowledge the fact that they are significant contributions.
Yeah, I'm sure it's great to have all the help.
So, yeah, you brought up some of the features.
Let's go ahead and talk about them.
Like one of the things that you have in there is linting.
And you said like somebody added just prospector.
So what's the story?
And maybe just for people who don't know, like what is linting?
And then tell people about some of the options there.
Yes.
Linting is basically just the ability to see what all of the error messages are, the errors that you could have in your program.
For instance, if you've written a Python code, block of code, if something isn't indented properly, or if you've got some typos, some keywords are misspelled.
So this is where the linters would come in and tell you before the program is run, hey, these are potential issues.
Here are some warnings or these are some definite errors.
So you've got different sorts of categories.
So basically a linter is kind of like a pre-compiled time error checker.
There's a number of tools in the Python space.
Which ones are built in or do you have support for?
In the Python space, there are plenty of packages that provide linting capabilities.
So for instance, if I'm not mistaken, the most popular ones are PyLint, Prospector, PyDocStyle, Flake8, and so on and so forth.
So if I were to look at these linters, there are two categories.
One is that checks for formatting.
And the other one is that looks at your code itself to check whether there are errors within the code.
Yeah.
So on one hand, you might have like PEP 8 checks, right?
For like there should be no space after this comma.
There should be no extra parentheses or whatever.
And the others might be like, here's an unused variable.
Is that a problem, right?
Those are maybe the two categories if you put some examples on it, right?
That's correct.
So what's really great is I don't really have to write much code because people or communities out there have built these tools.
All I'm doing is utilizing those and displaying those results through Visual Studio Code, just surfacing it through Visual Studio Code in a consistent manner.
So this is where, again, Visual Studio Code really excels because it provides a consistent look and feel across all languages.
So whether you're using C#, TypeScript, or any other language, the error messages would be displayed in the same way.
I see.
And you just, your extension plugs into that error message notification system or whatever, right?
Yes.
Yes, it does.
Nice.
Okay.
So linting, built-in, that's pretty awesome.
And lots of support for different linters.
Cool.
And then we have IntelliSense or autocompletion, including support for type-ins, right?
Yes.
So, yeah, let's talk about that a bit.
This one's supported, again, through a Python package that's been developed by David Halter.
Is it David Halter?
Sorry if I'm not pronouncing his name correctly.
But, yes, it's a great little package because all of the hard work has been done by this particular package.
Oh, nice.
And it's called JEDI, right?
Yes, it's called JEDI.
Okay.
So it was developed by this individual.
And this particular package is used today in a couple of other editors as well.
I know Atom uses it.
Sublime uses it.
Including, if I'm not mistaken, PyCharm 2 uses it to provide IntelliSense when you're debugging Python code.
It's a serious package that's used by some major players out there.
So, and I've made use of it as well to provide the IntelliSense capabilities for the extension.
It's not just IntelliSense.
It gives you the ability to inspect your code and understand the structure of your code as well.
Yeah, I was pretty impressed, like, how much of the structure of, like, if I'm working on a package, it understands my code, not just the standard library and things like that.
Yes.
So as mentioned, it's a really great, great little package.
So kudos to David.
Yeah, and that's awesome that you're not necessarily starting from scratch, but you're able to build on this really mature thing.
And benefits to or improvements to Jedi are improvements to your tooling as well, right?
Yes.
I think it was sometime mid to late last year that's when he added support for PEP 484 in a new version.
And yes, so I got the benefit of supporting PEP 484 in the extension.
So people don't really realize that the support comes through another Python package.
They just assume, oh, wow, the extension now supports this.
Well, in fact, yes, it does.
But again, thanks to the Jedi plugin.
Yeah, that's really, really cool.
You can look good just building on the shoulders of giants, as they say, right?
Yes, yes.
Cool.
And then you have support for PySpark and things like Jupyter and IPython notebooks, too.
Yes.
What's that look like?
Support for PySpark and Jupyter is really very basic at this stage.
So what we do is we can execute certain code against one of these engines and the results,
whether they are just raw output or whether you've got graphical output can be displayed.
So you could have two forms of graphical output.
One is just a static graph or the other one is a graph that you can interact with or interactive graphs.
So those are supported as well.
And the reason this was added is because sometime around mid to late last year, I noticed,
oh, we, when I say we, it's back then I was working at Microsoft.
We noticed that there was quite a lot of interest in the data science community for Python developers.
And that's when we felt, okay, we need to add some tooling around that space so that we could draw the data science community into the Visual Studio editor.
And also the Azure team, the Azure data science team does a lot of stuff with Python as well, right?
That's correct.
They use the PySpark.
They use PySpark for some of their work.
In fact, they had made some contributions to the extension to resolve some issues to ensure it worked properly with PySpark.
All right.
So another thing you have, obviously, is auto-indenting.
Like how much work was that?
How did you pull that off?
That's the one thing where I'm like, oh, I can't use Visual Studio Code for Python,
even though I thought it was cool because it just didn't understand how to work with the structure, right?
It's interesting that you ask how much work went into that.
In fact, very little work went in there.
But if I'm not mistaken, maybe half a page of code or even less.
Again, this is where Visual Studio Code excels.
It just provides the capability for me to give it the rules for indentation with the use of regular expressions.
And that's exactly what I did.
And Visual Studio Code just handles the rest.
So it was a really simple bit of a simple block of code.
And Visual Studio Code does everything.
Okay.
Yeah.
Very, very cool.
It's nice that that's built in, right?
That makes adding these extensions to be cool.
Oh, yes.
It made my life easy as well.
So I wouldn't have to just tab, tab.
And it was just awesome.
Cool.
And you also have like code formatting, like code cleanup, kind of almost like linting.
Yes.
Code formatting, just like linting, as you mentioned.
We've got two popular linters out there, Autopef8 and YapF.
So once again, I'm not doing much of the work, if at all any.
I'm just making use of some pre-built packages.
So take the packages that someone out there has built and provide the capabilities in Visual Studio Code.
So the developer using Visual Studio Code can choose the format of choice, either Autopef8 or YapF.
And they could configure it as well.
They could configure Autopef8 or YapF by using the corresponding configuration files and adding it into the project directory.
Oh, great.
Yeah.
I just put like a config file right there and it just works.
It just works.
That's correct.
That is the intention.
Yes.
That's nice.
And it integrates with the command line that way as well.
So like if you do it in Visual Studio Code, it'll pick up the config files, but also like automated builds or something, huh?
Yes.
So when developing this extension, one of the main requirements was people should be able to use either PyCharm or Sublime or whatever editor they prefer.
We're not trying to restrict users to keep using Visual Studio Code.
There are a few places where you'd have to add custom settings into Visual Studio Code, but as much as possible, you're not tied to Visual Studio Code.
Yeah, that's a really great goal or thing to keep in mind.
Nice.
And you have pretty decent refactoring support as well.
Not all the refactorings maybe, but the most popular ones, right?
Yes.
What does it support?
The most popular ones that we felt was necessary was renaming a method name or function or variable.
So it's rename and extracting variables and extracting methods.
So those are the three main or two main refactoring capabilities that we wanted to add.
And once again, I didn't have to do much in there.
I just made use of a popular package named Rope.
So this is Rope for Python.
And that provides all of the refactoring capabilities.
Apart from the rename and extract refactoring capabilities, there's also the sorting of imports.
So again, I just made use of iSort package, which does the sorting of the imports.
So yes.
Oh, that's excellent.
You said that there was something about the maintainer with Rope that it's a great package, but it was like it had gone dormant or something?
Yes.
When I started using Rope, I came across a couple of issues.
And then what I did was, as any other developer was, just raise those issues on GitHub and then notice that it wasn't getting looked at.
That's when I learned that it had gone fairly dormant.
And after getting in touch with the contributor, I learned that he was unable to maintain it.
And that's when they were looking for, he was looking for another contributor.
So it was, I've got to bring this out because it's really sad that you've got such popular tools that's in the public space that are used by, well, hundreds of users and plenty of people rely on them.
And you only have just one contributor.
So it's really important that we all pitch in and try to pitch in as contributors.
And it can be hard, too.
You know, like there have been a few things where I'm like, oh, this just needs a little tweak and it would be nicer.
And I'll do like, I'll raise an issue on GitHub or I'll do a pull request.
It feels the worst when you like, you go fork the repo, you'd make the fix.
You're like, yeah, this is like really good now.
And you do a PR and like people aren't even bothered to even like merge it, you know, you're like, oh, but it's like so close.
Just press merge.
It won't even conflict, you know.
And yes.
And what do you do?
I mean, it's tough.
But on the flip side, right?
Like these people have lives beyond the projects that they create.
And so you can't really be too upset with somebody for not maintaining a thing for free.
Yes.
It's just the challenge of open source.
Do you think that's going to grow?
I sort of feel like as open source grows and more people come into this community and this way of working, that it's going to actually be a bigger problem.
I wouldn't say it's a problem.
It's just the responsibility falls on us, on us developers who are using it.
So we've got to pitch back.
We've got to pitch in as well.
So it's a little bit of give and take.
So if we're going to take something from the community, we need to give something back as well.
So we need to be, we need to take the time to contribute, to help the contributors, to resolve issues or, you know, look at some of the questions.
Because I can see quite a lot of that happening in my project.
Plenty of people just come in and they answer questions that other people have.
And it's really great.
It's really great.
I guess that's what we need a lot more of.
Yeah.
Nice.
Okay.
Another thing that you have built in is viewing references and code navigation and viewing signatures and stuff.
And that's, you see, that also is basically just standing on the shoulders of Jedi, right?
That's correct.
Again, Jedi is one package that's developed by David.
So it provides the ability to look at your code.
So when you say look at your code, it gives you the structure of your code.
And that's where you have the ability to look at the references, code navigation, or signatures.
Nice.
So code navigation and signatures.
That's pretty explanatory.
Viewing references.
You mean if I write a function or a class or something showing all the places in which it's used in the rest of the code across my other files.
That's correct.
Okay.
Yeah.
Pretty excellent.
Yes.
So this is where, again, Visual Studio Code is really great because it provides a very consistent way of navigating or viewing references.
So whatever, irrespective of your language, the UX is consistent.
Whereas if you were to go to something, if I'm not mistaken, in Atom, there is no consistent UX for viewing references.
Because each developer, each author of extensions, they've got to build their own UI around these things.
So if I'm not mistaken, that's how it is.
It is pretty cool that I could be there working on, like, a Python web app, and the CSS support and the JavaScript support and the Python support and the HTML support all have the same basic gestures and UIs and way of doing things.
That's a cool extension system they've built in.
Very nice.
Yes.
So you have some pretty serious debugging support.
When I read that, I thought, wow, you guys are really adding a lot of interesting things.
So on your page, it says you have excellent debugging support, including remote debugging over SSH, multiple threads, Django, Flask, and so on.
How did you pull that off?
I have to say this is one of my favorite features.
I say it's one of my favorites simply because it's something that I use quite a lot of.
And it made my life a lot easier as well.
Initially, I have to say, just add a little bit of history.
The debugger was built on PDD.
And then once I added the debugger, I noticed that plenty of people were using it and commenting on some of the issues.
And then I realized, oh, wow, plenty of people are using this.
And back then, I was looking for a way to improve the debugging capabilities.
And at that time, I was using both PyCharm and PTVS.
So that's Python tools for Visual Studio.
When I looked at the source code for PTVS, I realized that their debugger was built completely in Python.
And that's when, you know, a light bulb went ding.
And I was like, oh, since I've used all of these packages for IntelliSense and Linting, I could do the same here as well.
So all I did was took this Python package, Python code, and built a debugger around that.
So again, thanks to Microsoft and the PTVS team, the support for debugging is awesome in this, simply because of the awesome work that they've done in PTVS.
Yeah, that's really cool.
You're able to pull it out of there.
And the Python tools for Visual Studio, that's like the big, more heavyweight IDE that runs on Windows.
That's also open source, isn't it?
Yes, it is.
Yeah, okay, so that was pretty easy for you to kind of merge those things together.
Yes.
This portion of Talk Python to me is brought to you by Hired.
Hired is the platform for top Python developer jobs.
Create your profile and instantly get access to 3,500 companies who will work to compete with you.
Take it from one of Hired's users who recently got a job and said,
I had my first offer on Thursday after going live on Monday, and I ended up getting eight offers in total.
I've worked with recruiters in the past, but they've always been pretty hit and miss.
I tried LinkedIn, but I found Hired to be the best.
I really liked knowing the salary up front.
Privacy was also a huge seller for me.
Sounds awesome, doesn't it?
Well, wait until you hear about the sign-in bonus.
Everyone who accepts a job from Hired gets $1,000 sign-in bonus.
And as Talk Python listeners, it gets way sweeter.
Use the link Hired.com slash Talk Python to me, and Hired will double the signing bonus to $2,000.
Opportunities knocking.
Visit Hired.com slash Talk Python to me and answer the door.
And of course, unit testing with all the frameworks.
Yes, unit testing.
It supports the three major frameworks.
Unit tests, built into Python.
There's pytest and NoseTest.
So initially, I started out with just adding support for unit tests,
and then found that adding support for pytest and NoseTest was very easy as well.
So just as the linters and formaters, these are just treated as separate packages.
So all we do is we just need, if one were to run unit tests as a Python developer,
you could just go into the command prompt and run these tests.
So that's pretty much what I am doing.
I'm just running these things in a shell and capturing the output and surfacing it to the user.
Does it appear in like a console, or does it do more like highlight some of the code with coverage,
or like does it affect the UI in the editor, or is it more like here's the console and the outcome?
At this stage, it's primarily in a little console, because there is Microsoft, if I'm not mistaken,
they do not have a consistent, they do not have a UI for unit tests.
So back when I was working on this extension, which was last year, they did not have anything.
So they were looking at adding support for some UI, because this is something they need across other languages as well.
So just as, you know, viewing references or debugging, where you've got consistent look and feel for these capabilities,
it's something that they didn't have for unit tests.
So at this stage, it's just console window.
Okay, yeah, that makes sense.
And there's like a little console that can be in the bottom of the editor, a little like PyCharm, right?
Yes.
However, what we have added is for each class of method, there is something new.
What we've got is we've got something called code lenses.
Basically, it's just this floating link or floating text that you can click on to run or debug a unit test.
It's fairly easy.
Once you've got a block of code, and if it's a unit test, you've got some link within the code that you can click on.
Oh, that's cool.
There's like a little button next to the test method in your unit test itself.
And you can just click that and run the one?
Yes, that's correct.
Oh, sweet.
Do you have any support for profiling?
At this stage?
No, it's been it's something that's been requested by a number of people.
So it's something that I'm looking at adding.
So no, it isn't supported at this stage.
Sure.
Okay.
One thing I thought was cool that seems like you support pretty well is virtual environments and Python versions and things like that.
Do you want to talk about how whether you've got that or how it works?
Yes.
Virtual environments are supported.
Now, initially, it took me a while to get this working because I would say it took a couple of iterations to get this working.
The way virtual environments are supported is we and the extension.
All I do is it's up to the developer to define the location of the virtual environment.
So you could have virtual environments within the project directory or somewhere else.
So I have no idea.
I'm not going to try looking for it.
It's up to the developer to define it in the settings file.
So this is one of those places where you have custom Visual Studio code-specific settings.
It's a file named settings.json.
You define the path and the name of the setting is Python path.
So you define the name, the path to the Python interpreter.
To make lives easier, what we've got is we've got a little shortcut.
So you could go into this particular menu item and launch a particular command palette which says select the Python interpreter.
So what we do is, in the extension, try to look for the common locations where you could have your Python interpreters or your virtual environments, whether it's in the current directory or some other known locations.
We look through those directories and list it out to you.
So all you have to do is, from that list box, you just select it and done.
If it's not there, you'd have to just manually type it.
And yeah, that's it.
Yeah, that's pretty nice because I do almost all of my, at least my web projects, almost all of them from, you know, each website gets its own virtual directory.
And having that there, I'm like, oh, I don't know if I can edit this thing because of Visual Studio code because it's all the stuff that's installed over here.
I'm like, oh, wait.
Yeah, I totally have support for that.
It's very cool.
Yeah, and you also have like little Python terminals and local help.
Those are all great.
And then I guess the last major feature is our snippets.
What are snippets and what are the nice ones you got?
Snippets, well, I wouldn't say they're nice ones, but it's basically certain snippets like having a try snippet or just for a class.
So those are the kind of snippets that I have in there.
I wouldn't say there are some really great snippets, but it's something that just makes life a little bit easier.
I see.
So I can type like try and hit tab and we'll expand out to try colon pass, accept expression as a dinner vehicle.
All right.
Or I could do, can I do like width?
Yeah, like width blocks.
And yeah.
So just the common structures probably of if and whatnot.
That's correct.
Okay.
Yeah, very nice.
Can we add our own?
If we're like, oh, this is cool.
I'd like to have it do this when I hit tab and it doesn't.
Good question.
I have no idea.
I haven't had this question been asked by anyone on GitHub.
So I wouldn't be surprised if it were possible.
However, I'm not sure.
I have no idea to answer the question.
I don't know.
Yeah.
That's a good question, though.
All right.
Well, maybe I'll file a GitHub issue and you can say yes here or no.
We'll add it.
Awesome.
So it sounds to me like to some degree you've done, obviously, a large amount of work.
But the really what makes it look like it would be extreme work, like the remote debugging, multi-threading over SSH shells and things like that come from other packages, actually.
And so how much of this is like pulling other packages together?
I would say majority of it, if not all of it, has been done by the other packages.
Because as I mentioned earlier, the code is primarily written in Node.js or TypeScript because that's what Visual Studio Code is built on top of.
And to provide the capabilities for individual language features like IntelliSense, debugging, linting, all of that is done through individual Python packages.
So all I'm doing is just making use of them.
That's really cool.
How do you do the interprocess communication between like Python, the Python packages, and the Node.js stuff that is really running Visual Studio Code?
So that's fairly simple for something such as linting or code formatting.
All I'm doing is in the background, I'm just launching a particular process, a Python process, and running the corresponding Python package against a particular file or particular block of code.
And I just capture the output and display it.
For some of them, it's not as straightforward as that.
For instance, with the debugger, what I've got to do is I start the Python package, which is the debugging package, and communicate with that process using sockets.
Okay.
So, for instance, it's different.
Like, for instance, debugging and running unit tests, I'd use sockets.
And the others, it's just basically simple communications, just reading the output from the…
Just shell out and capture it, yeah.
Yes.
Okay.
How much time did you spend on this, getting this all up and running, do you think?
Like, how long from December until it's more or less looking like what it is now?
Around May, it was…
We had quite a lot of the capabilities built in, apart from running unit tests and adding support for PySpark and Jupyter.
So, until then, there was plenty of support for linters, debugging, and code formatting.
So, I would say half of it around May, and then the remainder was completed around November of last year.
So, just under a year.
It took just under a year to complete everything.
That's…
Yeah.
And how many…
That was mostly you, right?
Yes.
That's correct.
So, yeah.
That's a lot of cool stuff that you got out in that short amount of time.
Nice.
It was really interesting working on this.
So, as I mentioned, when I started out this pet project of mine, it was just early.
I was in the morning, and then over time, I learned, oh, it was getting really popular.
And then that kept motivating me because there are plenty of people using it.
Like, oh, well, this is really doing well.
Let's just keep churning more code, putting more features in there.
Yeah.
That's awesome.
I think two really motivating things about writing software are one of them is you get to either work with a really cool technology
or the thing that you're actually building is a cool technology or some combination thereof.
And the other is that lots of people use and appreciate whatever it is you build, right?
Yes.
I think the most important thing was the appreciation because even though there was plenty of people downloading it,
I mean, getting to know that people appreciate the work that you've done, it makes a big difference.
Yeah.
I'm sure.
And so, what other, you know, if you get something with a million downloads, what other opportunities come with that?
Like, have people reached out to you to do cool stuff?
I did get one opportunity and that was Microsoft.
They approached me around early May last year.
They approached me and they asked me if I would like to join the Visual Studio Code team and work full time on this extension
because they saw that it was a great extension and they wanted me to spend full time on it so that it could be polished and it would be feature complete.
When I say feature complete, we could take the time out to iron out some wrinkles and ensure it integrates well with Visual Studio Code.
And also, if there was something that I wanted added into the co-product, I could, you know, do that myself as well.
That's pretty awesome.
So, that was, yeah, it was really great.
So, that's when I gave up my 10-year role at a previous place and I was like, oh, yes, I will jump ship.
Yeah, you get to just get paid to work on such a cool project.
I've seen them do that before, hire people to basically continue to work on something they saw really valuable that was integrating kind of in the style.
That's great.
Yes.
Are you still working there on it or are you kind of got it where it used to be?
Oh, so, my contract ended last year.
So, it was just a six-month contract, but no regrets there.
So, enjoyed the time while working there, working for Microsoft.
And so, I've moved on since then.
Okay, cool.
Now, I want to ask you about the other extensions you've written because you have a habit of writing Visual Studio Code extensions, apparently.
There's some cool ones.
Yes.
But before I do, before I do, I want to ask you, is there a way to write extensions for your Python thing?
Like, if I had something I wanted to add, is there a way, like, how can I change or extend what you've done?
Do I have to go into a PR directly against it or is there some other way to get in there?
It's just a PR.
So, pull the report down to your local machine and then make the changes.
So, as I mentioned, it's all done in Node.js.
So, you've got to use TypeScript to make the changes.
Nice.
Okay.
Very cool.
So, all right.
Let's just really briefly touch on some of the others that you've written.
I'll just go through the major extensions that I've developed.
One is the Java debugger.
Back then, I was playing around a little bit with Java as well.
And I was looking around for the ability to debug Java code.
And I really hated Eclipse or the others because it was just too bulky and it took a long time to load up.
By then, I had some experience with PDB and I figured I could build a Java debugger as well using the similar capability, similar concepts.
And that's exactly what I did.
So, I built a Java debugger.
It's not as popular, but there are plenty of people using that.
And the other extension is create unique IDs.
Basically, it's just the ability to create unique IDs like GUIDs or random numbers and it inserts it into the text.
Then there's BOA or Bauer.
It's just a little tool to restore BOA packages.
It was popular in the early days when Visual Studio Code didn't have an integrated terminal, but now it does.
So, for Python developers, basically, it's a tool to restore dependencies from your requirements of TXT file.
That's pretty much it.
So, if you've got your terminal, you can do it using your terminal.
That's why it's no longer popular.
The next most popular extension that I have is GitHistory.
So, I built this again for personal use.
I was after an extension that I could use to look at the GitHistory log.
So, I built this one again using TypeScript and it's just a wrapper around the Git.
And at this stage, it's quite popular.
If I were to bring numbers, it's the 12th most popular extension out there with around 350,000 downloads.
And I have to say that currently it's being maintained primarily by Mike Surkopf.
I'm not sure how it's pronounced.
He's the one who's looking at all of the contributions at this stage while I focus on Python and the others.
Yeah, that's cool.
Lastly, the other extension is jQuery code snippets.
That's a simple extension that gives you a lot of code snippets for jQuery.
Okay, yeah, that'd be really nice.
Are you working on any new ones?
There is one that I'm trying to work on.
I just haven't been doing much work on that for the past couple of weeks.
It's pulling the code which supports Jupyter out of the Python extension because there are other languages that could use the Jupyter kernel.
It's not just Python.
So, I'm just trying to pull that out so others could use that or other languages could make use of it.
Okay, yeah.
That'll be really nice to separate those if people want to use them in R or whatever.
Yes.
Okay, nice.
Well, I think people have a pretty good idea of this extension.
And it's all open source.
It's all free.
So, if you're looking to try a pretty seriously rich Python editor cross-platform Linux, OS X or macOS and Windows, then, you know, check out Visual Studio Code and go check out the extensions and pick.
Basically, you don't just pull up the extensions and you're like number two, right?
I guess search for Python if it doesn't show up.
There's more than just your extension for Python.
So, yours is – what's the exact name?
Is it –
It's just Python.
Just Python.
Yeah.
So, you got the straight up name all by itself.
Awesome.
Okay.
So, let me ask you two questions before we go and then give you a chance to sort of let people know what they can do to get started or help out.
I'm not really expecting a surprise here, but what's your favorite editor when you write some Python code?
I would say it is Visual Studio Code simple.
It's something I can use across both the Mac and Windows, and it's very lightweight.
I can go to a different PC, just download it, install, done.
So, it's just super lightweight and easy to use.
Okay.
Yeah, very nice.
And favorite PyPI package?
I would say there are two.
One is the Jedi.
Well, it's not something that I use on a day-to-day basis on every project, but it's something that I've used in the Python.
And I really value that.
And as a developer, the favorite package would be requests.
Yeah.
That's definitely a popular one.
That's a really, really great package.
All right, Don.
So, final call to action.
Like, you're looking for people to work on this project, help out, give you feedback.
What can the listeners do?
Oh, yes.
Any contribution is really welcome.
At this stage, there are two major items that I need to work on.
One is profiling, and that doesn't look too complicated.
The other one is adding support for remote interpreters.
So, this is where you do not have Python installed locally, but it's running on a different machine, maybe on a Docker container or something.
And you're editing your Python files locally.
So, that's something that plenty of people have requested.
So, it's not just that.
So, any contribution, really welcome.
I'd really appreciate that.
All right.
And, yeah, the future for the extension, where are you going with this thing?
I'd just keep trying to extend it and adding more capabilities.
So, the way I do this is by looking at other IDEs and adding capabilities from there, for instance.
Looking at what Visual Studio or PDVS or PyCharm support, and I'd say, oh, maybe I could add that and try to plug it in here.
All right.
Very cool.
So, thank you for contributing this, Editor.
It's definitely got a lot of features, and it's pretty unique.
So, thanks for creating it, and thanks for sharing your story with everyone.
Thank you very much for having me, and thank you for sharing this with everyone else.
So, yes.
Absolutely.
Happy to.
It's a cool project.
Talk to you later.
This has been another episode of Talk Python to Me.
Today's guest has been Don Jayamane, and this episode has been sponsored by Talk Python Training and Hired.
Thank you both for supporting the show.
Are you or a colleague trying to learn Python?
Have you tried books and videos that just left you bored by covering topics point by point?
Well, check out my online course, Python Jumpstart, by building 10 apps at talkpython.fm/course to experience a more engaging way to learn Python.
And if you're looking for something a little more advanced, try my Write Pythonic Code course at talkpython.fm/pythonic.
Hired wants to help you find your next big thing.
Visit Hired.com slash talkpythontome to get five or more offers with salary and equity presented right up front and a special listener signing bonus of $2,000.
Be sure to subscribe to the show.
Open your favorite podcatcher and search for Python.
We should be right at the top.
Our theme music is Developers, Developers, Developers by Corey Smith, who goes by Smix.
Corey just recently started selling his tracks on iTunes, so I recommend you check it out at talkpython.fm/music.
You can browse his tracks he has for sale on iTunes and listen to the full-length version of the theme song.
This is your host, Michael Kennedy.
Thanks so much for listening.
I really appreciate it.
Smix, let's get out of here.
Outro Music.
Thank you.