Latest / Talk Python To Me / #36: Python IDEs with the PyCharm team
Transcript
- 0:00As a software developer, what's the most important application on your computer?
- 0:03If your answer is Microsoft Outlook, my heart goes out to you. Stay strong. But for most of us,
- 0:09it's probably a toss-up between our web browser and code editors. And for editors, there's basically
- 0:14two camps. There's the lightweight, smart text editors such as Vim, Emacs, and Sublime Text,
- 0:20and heavyweight but highly functional IDEs such as PyDev and PyCharm. This week, you'll meet
- 0:26Dmitry Trophimov, who's one of the main developers behind one of my favorite editors, PyCharm.
- 0:32This is episode number 36 of Talk Python To Me, recorded November 11, 2015.
- 0:53Welcome to Talk Python To Me, a weekly podcast on Python, the language, the libraries, the
- 1:07ecosystem, and the personalities. This is your host, Michael Kennedy. Follow me on Twitter,
- 1:12where I'm @mkennedy. Keep up with the show and listen to past episodes at talkpython.fm,
- 1:17and follow the show on Twitter via at talkpython. This episode is brought to you by Hired and OpBeat.
- 1:23Thank them for supporting the show on Twitter via at Hired underscore HQ and at OpBeat.
- 1:29Hi, everyone. Thanks for listening to this episode. I have a few quick comments before we get to the
- 1:34interview. Some of the features we talk about are better understood visually rather than described
- 1:40in audio. And for that reason and others, I decided to write a blog post visually highlighting
- 1:44some of these concepts. This post is called Nine Reasons You Should Be Using PyCharm. If you're
- 1:49interested, check it out at bit.ly slash whypycharm. Last but not least, the PyCharm team at JetBrains
- 1:56offered to give away three annual subscriptions to PyCharm Professional. I'll do the drawing Monday,
- 2:02December 7th. That's a week from the release date of this podcast. All you have to do to be eligible is
- 2:07become a friend of the show. Visit talkpython.fm and click Friends of the Show in the navigation
- 2:11bar and sign up. Now let's get on to the show. Let me introduce Dmitry. Dmitry Tarfimov currently
- 2:18leads the development of PyCharm, a popular Python IDE by JetBrains. Dmitry is passionate about
- 2:24automation and software tooling. Before PyCharm, he implemented many different tools for a variety
- 2:29of companies, including a visual site scraper generator, a model to code mapper, and even a
- 2:36generator for hardware used in submarines. In his spare time, he's a committed running enthusiast
- 2:41and triathlete. Dmitry lives in Munich, Germany. Dmitry, welcome to the show.
- 2:47Hi, Mike.
- 2:48Hi. I'm really excited to talk about PyCharm and JetBrains and editors and tooling for Python
- 2:55with you today. It's going to be great.
- 2:56Yeah, sure. Thanks for inviting me.
- 3:00Yeah. So before we dig into all that, let's start at the beginning. How'd you get into
- 3:05programming in Python? What's your story?
- 3:06That was long ago, actually. My first programming experience was when I was something about seven
- 3:15years old. Back then, I had a ZX Spectrum computer and it was possible to program it with Sinclair
- 3:22BASIC. So I read a book about programming in BASIC and found some source program inside the book.
- 3:30And this program is supposed to do something cool. So I sit down and typed all the program into the
- 3:37computer, actually without full understanding how does it work. I was seven and I typed quite slow.
- 3:43So it took like, I don't know, like an hour or something to type that program in. And after I
- 3:48finished, I felt relief. But then when I tried to run it, it just failed. You know, so it didn't start.
- 3:56And I had no clue why. The error message was totally unclear for me. And it was very frustrating. Nobody
- 4:02could help me because I was at home alone. And I felt like I was betrayed by the book, which I trusted.
- 4:10So yeah, maybe if I have started to learn programming today with Python and PyCharm, for example, I would have
- 4:18much more pleasant experience. At least Python is a much, much better language. And PyCharm would hint
- 4:25me about which error I had and which is more important to where it was. So yeah, maybe. But my programming
- 4:31story didn't end there, obviously. Several years after I went into a computer class where I learned how to
- 4:37program Pascal, there was a brilliant teacher and Turbo Pascal IDE. And I learned step by step. And
- 4:45at some point, I realized that I can do computer programming in Pascal. Maybe that's why I'm a fan
- 4:53of IDEs because of Turbo Pascal. I don't know. Maybe that could be an imprint for me.
- 4:59Was it a young, impressionable programmer?
- 5:02Yeah. Awesome. So how'd you go from Pascal to Python?
- 5:07Actually, from Pascal, I converted to Java directly. So it was C and Assembler in the middle somewhere.
- 5:17And then I've been doing a lot of Java. And at some point, I realized that I need to have a scripting
- 5:27language in my toolbox. But I couldn't choose which one. And I wrote one small project in several
- 5:35languages just to be able to compare them. I took Groovy, Ruby, Python, and Perl. Perl was a total disaster.
- 5:42But others were more or less equal. But I remember my impression from Python. That felt pretty much like
- 5:53all other languages. But at the same time, very different from them. And everything felt
- 6:00reasonable and easy there. And I did like that. So since that, I used Python from time to time.
- 6:09And then I joined JetBrains to make a new IDE for Python called PyCharm. It was in early beta. And so I'm
- 6:20working on it till now. It was five and a half years ago.
- 6:24That's really excellent. And I've never heard people choosing a language the way you just described
- 6:30it. But it's such a good idea to say, look, I'm interested in learning this type of language. And it
- 6:38looks like there's these choices, four or five or six or whatever. And the idea of writing a simple
- 6:43program in each and then comparing the experience, that's really cool. I think more people should adopt that.
- 6:49Yeah, I gained a lot of experience doing that. And it was fun.
- 6:55Yeah, I always kind of just gone with, you know, do the research, see what's popular, what are the capabilities,
- 7:01what are the pluses and minuses, and then I'll just dive into one and just try to learn it. I never did sit down and like,
- 7:08do a bunch together and compare and contrast. That's cool. PyCharm. Before we get into PyCharm,
- 7:15maybe, you know, when I think about the company that makes PyCharm, JetBrains, where you work,
- 7:20I see you guys as one of the premier, if not the premier, developer tool companies out there.
- 7:29Can you maybe just talk a little bit about what is JetBrains, what type of apps and products you build?
- 7:35Yeah, sure. JetBrains is a company that makes tools for software developers, as you said. And
- 7:45currently, there are more than 500 people working there. And we have offices in St. Petersburg,
- 7:51Munich, Prague, and Boston. So the two biggest development spots are in St. Petersburg and Munich.
- 8:00And yeah, we make tools for software developers. And actually being ourselves software developers,
- 8:08this allows us to make really good tools. You know, there is a culture in JetBrains that everybody
- 8:15writes a code. Even our sales, they do program a lot, actually. So the company grows, but this is very,
- 8:26this is amazing that this culture stays. And talking about our products, of course, we have
- 8:34many ideas like PyCharm, IntelJ IDEA, RubyMine, PHPStorm, WebStorm, CLion, AppCode. So for
- 8:43basically for most major and popular languages, even if there is no IDE for a language, there should be a
- 8:53plugin that is maintained by JetBrains or third parties. So the IntelJ platform is quite, quite
- 9:00diverse and solid. Yeah, that's, that seems to be kind of the foundation of most of your IDEs. I kind of see
- 9:08you guys as the company that looks at what other software development systems are doing or build
- 9:16that and fixing the problems. Like, you know, Microsoft makes Visual Studio and it has, it's not bad, but it
- 9:22has these issues. And so you guys make ReSharper. Yeah, exactly. Exactly. And then, you know, Apple makes,
- 9:29Apple makes Xcode, but you're like, oh, this is not so great.
- 9:32Yeah.
- 9:34Yeah.
- 9:36Yeah.
- 9:38Yeah.
- 9:40Yeah.
- 9:40Yeah.
- 9:42Yeah.
- 9:50Yeah.
- 9:52Yeah.
- 9:52Yeah.
- 9:52Yeah.
- 10:02Yeah.
- 10:02Yeah.
- 10:02Yeah.
- 10:04Yeah.
- 10:04Yeah.
- 10:06If they're willing to have the time and energy and interest to actually learn the tools.
- 10:12Tools are very important.
- 10:14I wanted also to add that many people know about our ideas, but less people know that also we create other tools for software development.
- 10:26So we have a range of server-side tools.
- 10:28It is continuous integration called TeamCity.
- 10:33There is a bug tracker called Utrek.
- 10:36And there is a code review tool called AppSource.
- 10:40And we even make our own GVM programming language called Kotlin.
- 10:43So every area of software development, we try to make a product in this area.
- 10:50And actually, we use this product.
- 10:52And this allows us to make it good.
- 10:55Yeah, if you don't use the thing you're building, then you just...
- 10:58Yeah.
- 10:59It's just not good, right?
- 11:01You have to use the thing that you're building to make it truly excellent.
- 11:04Sure.
- 11:05Sure.
- 11:06All right.
- 11:06So like I said, I think most people know PyCharm.
- 11:09But maybe give us the 30-second elevator pitch.
- 11:12What is it?
- 11:13PyCharm is an IDE for Python.
- 11:15There are two editions of PyCharm.
- 11:18The first is PyCharm Community Edition that is free and open source.
- 11:23And it provides all basic functionality without any limitations.
- 11:27And there is a professional edition.
- 11:30It's not free, but it has many features, especially for professional development, like support for web technologies.
- 11:38There's many languages, like HTML, CSS, JavaScript, different JavaScript frameworks, Python web frameworks, like Django, Flask, Pyramid, Web2Py.
- 11:48And a lot of functionality, like working with databases and working with code on remote environments and profiling code coverage.
- 11:59So this is all in professional edition.
- 12:03Yeah.
- 12:04And you also have some cool database integration that I think we'll come back to in a little bit because it kind of blew my mind when I saw it.
- 12:10So I'm interested to ask you about it.
- 12:13One of the things that's cool about PyCharm, I think, is that it's really cross-platform.
- 12:18Yeah, that's true.
- 12:20PyCharm, as well as IntelliJ platform, is implemented in Java.
- 12:25So it basically runs everywhere where GVM can run.
- 12:30There are some parts that are native, but they are not essential for the main functionality, actually.
- 12:41And there are three operational systems that are officially supported.
- 12:46It is macOS X, Linux, and Windows.
- 12:50But actually, I know that our users even managed to run PyCharm on some environments like Raspberry Pi.
- 12:58And, you know, it's funny because we have issues in our tracker that sound like it's great that I could run PyCharm on Raspberry Pi.
- 13:07But unfortunately, embedded terminal is not working.
- 13:10So, yeah.
- 13:11So in that case, we just answer, okay, sorry for that.
- 13:16But embedded terminal is also open source.
- 13:19So you can port it to Raspberry Pi, send us a pull request, and something like that.
- 13:24Yeah, that's really funny.
- 13:27The fact that it runs on Raspberry Pi at all is pretty awesome.
- 13:30People are saying, oh, this part doesn't work.
- 13:33It's like, did you really expect it all to work?
- 13:35But yeah, that's cool.
- 13:37That's cool.
- 13:37I've seen somewhere, I think I even sent it on Twitter not too long ago, somebody had it running inside of a Docker container.
- 13:45Yeah, that's crazy.
- 13:46That's crazy.
- 13:46That's crazy.
- 13:47We just added support for Docker in the latest version.
- 13:52And so it was also a response like, oh, that's great.
- 13:57But what I want is to run PyCharm in Docker and then run containers from PyCharm.
- 14:04Yeah, it was, it's very nice.
- 14:06Actually, I don't understand this scenario yet, but I think I will try it myself.
- 14:12Yeah, it's probably just because you can, right?
- 14:16But when you guys announced support for Docker, that's like, you can create Docker containers that run your apps,
- 14:22not you can run PyCharm within Docker containers.
- 14:25But, you know, I guess someone got that working, which is cool.
- 14:28Yeah.
- 14:29So you said there's like 500 people at JetBrains.
- 14:32Yeah.
- 14:34Yeah, how many people are actually part of the PyCharm initiative?
- 14:38There are 14 people working directly on PyCharm.
- 14:43PyCharm is built upon Intel J Platform.
- 14:46So if we count those people, so it adds like from 50 to 60 people more that are contributing directly to Platform.
- 14:58But actually, that is not very easy to count because there are a lot of people who work on different IDs.
- 15:04For example, WebStorm.
- 15:07All functionality of WebStorm comes with PyCharm Professional Edition.
- 15:12So do we count as an Intel J Platform or not?
- 15:14So that's difficult to measure.
- 15:18Yeah, there's a lot of intersection between the different IDE teams like AppCode and WebStorm.
- 15:23So, yeah, I can see that that's tricky.
- 15:25Okay.
- 15:26So it's a pretty large team, full-time team working on PyCharm, yeah?
- 15:31Yeah.
- 15:32Yeah.
- 15:32By the way, we're proud that we have a proportion of girls and guys like 50-50 almost in our team.
- 15:45That is really excellent.
- 15:46Cheers to you guys.
- 15:48That's great.
- 15:48So when I run PyCharm, you know, as Sid, it's built on Intel J.
- 15:54Like how much of the thing that is running that I'm working with is PyCharm and how much of that is just Intel J with like a little understanding layer back into Python?
- 16:05Actually, all the Intel J Platform is built that way that it is a language agnostic.
- 16:10So it's like a framework upon which you can write a parser and inspections.
- 16:16But there is actually no that strict separation.
- 16:25When you're getting started, there's different ways to get started in Python, right?
- 16:29One way is to just type Python in your terminal or command prompt and then start entering stuff into the REPL.
- 16:36That's probably the least productive thing you can do, although it's the easiest to get started, right?
- 16:41Like you can create variables and import modules and things like that, right?
- 16:46And then as you go up, you know, there's stuff like editors like Vim and Emacs and Sublime Text where, you know, they're really nice editors,
- 16:58but they don't necessarily help you understand the standard library and things like that necessarily.
- 17:05And then you've got PyCharm, which can help you with the language.
- 17:09Where do you think people should start?
- 17:12What are your thoughts?
- 17:13Is there a lot of value in starting sort of with no support?
- 17:19Or do you think it's more helpful to have like a really helpful environment, even if you don't necessarily learn some of the details right away?
- 17:27I think that the supportive environment is beneficial, actually.
- 17:33It even can help you to learn the language and it assists you.
- 17:38So I would prefer to start with an IDE.
- 17:44You know, we're both sort of self-selecting in that sense as well.
- 17:48But I kind of agree with you that, you know, it's great to memorize the API for things like requests or the string library.
- 17:58But, you know, if I can just hit dot and type T and it shows me all the other options that maybe I'll have on strings, you know, that's really helpful, right?
- 18:11As a new person.
- 18:12Yeah, sure.
- 18:13And you do memorize them, actually.
- 18:15Because it just takes less time when you see it in code completion, not in Google, for example, or documentation.
- 18:24So you get information faster and you do memorize it.
- 18:29There's some cool plugins that I want to come back to later to talk about that as well.
- 18:33But another thing that's really challenging can be creating new types of projects.
- 18:39So if I want a new Flask website based on Bootstrap or I want a Pyramid website based on the starter template or something like that.
- 18:51Can you talk about, like, sort of what the types of projects you can create in PyCharm as, like, starter projects?
- 18:58Yeah, sure.
- 19:00It's mostly all type of Python web framework.
- 19:05So it is Django, Flask, Pyramid, Web2Py, and also all kinds of pure web projects.
- 19:17Actually, the main project that you can create in PyCharm is pure Python projects.
- 19:21So you can just start with that, for example, and then you can add everything that you want.
- 19:25If you know that you are going to develop Django projects, then it's better to start with Django projects from the start.
- 19:31Because everything will be configured and you will have a template.
- 19:35Yeah, I think one of the things that people struggle with, and as you get experience, you forget that it's actually really hard.
- 19:43You're just like, oh, that's a little bit of extra work.
- 19:46But in the beginning, it can be really hard.
- 19:49So, you know, suppose I want to get started with Pyramid.
- 19:51Right?
- 19:53Well, to get started with Pyramid, I can't just, like, create a file and start typing, you know, create my WSGI app and here's my handler configurations and so on.
- 20:04I have to pip install Pyramid and the various dependencies.
- 20:10And then I've got to know to use, like, pcreate, the thing that will generate the template starter code or, of course, write it from scratch, which is a lot of work.
- 20:21And that will generate a whole bunch of stuff, a whole project structure.
- 20:24And then I've got to run, you know, the setup configuration stuff because it's all treated like packages and so on.
- 20:31And I think people that are experienced with Python sort of forget how non-obvious that part is, right?
- 20:38But having it just as a thing you click, I'd like a new Pyramid app, and all that stuff happens.
- 20:42You know, that's really cool.
- 20:44I think that's one of the things that's nice about, like, creating new projects with PyCharm is a lot of that configuration stuff and dependency stuff is handled all in one shot.
- 21:07This episode is brought to you by Hired.
- 21:09Hired is a two-sided, curated marketplace that connects the world's knowledge workers to the best opportunities.
- 21:16Each offer you receive has salary and equity presented right up front, and you can view the offers to accept or reject them before you even talk to the company.
- 21:25Typically, candidates receive five or more offers in just the first week, and there are no obligations ever.
- 21:31Sounds pretty awesome, doesn't it?
- 21:33Well, did I mention there's a signing bonus?
- 21:36Everyone who accepts a job from Hired gets a $2,000 signing bonus.
- 21:39And as Talk Python listeners, it gets way sweeter.
- 21:44Use the link Hired.com slash Talk Python To Me, and Hired will double the signing bonus to $4,000.
- 21:51Opportunity's knocking.
- 21:53Visit Hired.com slash Talk Python To Me and answer the call.
- 22:05True.
- 22:06True.
- 22:06True.
- 22:07True.
- 22:07True.
- 22:07True.
- 22:07True.
- 22:07But also, you can start, you're going to go step-by-step with PyCharm.
- 22:11So you can just create pure Python project, or you can just open a directory and create file there, and then start typing something.
- 22:21And when you have a user's name, PyCharm will offer you to install this package from PyPI, so you can do that.
- 22:28And it's not that strict that if you develop a pyramid, you need to start from a pyramid project and generate everything.
- 22:39Right.
- 22:39That's true.
- 22:40So it's possible that it's helpful for you, but if you already have a pyramid website, you can just grab the directory.
- 22:46Yeah, yeah.
- 22:46Sure.
- 22:47Throw it on PyCharm, then it'll sort of be as if you had created it, right?
- 22:50Yeah.
- 22:50PyCharm will understand the structure of your project so that it is actually a pyramid project and will configure pretty much of everything.
- 23:00I don't really want to necessarily just go through all the features of PyCharm, but maybe you could talk about a couple favorites.
- 23:08Like, for example, I think my two favorite features in PyCharm are the sort of smart IntelliSense, right?
- 23:17So I get code completion across all the files in my project, as well as all the packages that I've installed in my environment and the standard library and so on.
- 23:25So that sort of IntelliSense is really cool.
- 23:28And then the sort of navigation stuff, right?
- 23:32So I can say, oh, here's the function being called on some object.
- 23:35Take me to its implementation.
- 23:37What are your favorites?
- 23:38Actually, I also like IntelliSense and navigation, but my favorite is definitely the debugger.
- 23:48I don't know, maybe since those days when I wrote Pascal and Turbo Pascal at DEI, I always like the ability to dive into a running program and see what is actually happening there.
- 23:58Yeah.
- 23:58So, and I'm proud that PyCharm has a very solid debugger and we even have some almost unique features like debugging of sub-processes and debugging of applications on remote environments.
- 24:13I like this part most.
- 24:16Actually, we have quite good version control support, JIT support, for example.
- 24:25So it's not bad.
- 24:26I would even say amazing, but it could be considered a bit immodest for a JIT brain person.
- 24:31But yes, I like our JIT integration.
- 24:33And my favorite feature there is ability to compare different branches in JIT log.
- 24:39Okay.
- 24:40Yeah, that's pretty awesome.
- 24:40Local history.
- 24:41I'm sorry.
- 24:42So for interrupting, local history is amazing also.
- 24:45Yeah, I was definitely going to say, if you're talking about version control, this idea of local history is cool.
- 24:50Let's take a step back for a minute and dig into the other ones just for a moment.
- 24:55And then I want to talk about local history because that's really awesome.
- 24:57So how do you guys do IntelliSense for Python?
- 25:02Like how does that work in a dynamic language?
- 25:07How does it work?
- 25:08IntelliSense in PyCharm works that way that when you write your code in PyCharm, it's parsed in real time.
- 25:16And analyzed this way that PyCharm tries to understand what is your goal and how to help you the best way.
- 25:25So it offers you code completion.
- 25:29It reformats your code.
- 25:32It inserts correct indentation, for example.
- 25:36So it highlights, of course it highlights syntax errors.
- 25:41But beyond that, it also tries to warn you about some errors that are not so obvious.
- 25:49So if, for example, you reuse a variable that you iterate through in a cycle or if value could be undefined, how is it implemented?
- 26:04Well, more what I'm thinking is, you know, when I write Python code, I don't ever declare a type.
- 26:10I don't say, you know, int x equals 7.
- 26:13I just say x equals 7.
- 26:15And, you know, sometimes it's really obvious, right, when you declare it just like that.
- 26:20But sometimes, you know, there's a long chain of events that leads to data being passed from one stage to another, to another, to another, to another, to finally being assigned to a variable.
- 26:29And it seems like you guys do a really good job of actually knowing what that's supposed to be.
- 26:32Yeah, we try to infer types for variables.
- 26:38And we do it quite, quite good.
- 26:40So it's called data flow analysis.
- 26:45When you write your code inside a function or a method, we trace the types of all the variables.
- 26:53Yeah, I think that's really awesome.
- 26:57And I think that's one of the benefits over things like Sublime Text, where if it sees you use some function or property of something that looks like an object above,
- 27:07it'll sort of then suggest it later as IntelliSense, but it doesn't really understand, like, the way the whole program fits together.
- 27:15It's missing a lot of the cool stuff that you guys have there.
- 27:18I know you just announced support for Python 3.5.
- 27:22True.
- 27:22And that includes this thing called Python Type Hints.
- 27:27Yeah, actually, PyCharm team participated, was involved, actually, in the process of elaboration of this proposal.
- 27:37That's really cool.
- 27:40Maybe before I ask you a question about it, maybe you could tell everyone what those are.
- 27:45There is a PEP 484, so-called, this is initiative adding a declaration of typing into Python.
- 27:56So before there was no standard way to annotate types.
- 28:02It was something starting from Python 3, but it was very limited and couldn't be used extensive.
- 28:11In Python 3.5, Gubito Warren Rossum came up with a proposal of elaboration of standard notation for annotating types for arguments and variables.
- 28:26Yeah, so maybe an example would be I've got a function, sayHello, right?
- 28:33Maybe the function is called sayHello, and you give it a name and a time of day.
- 28:38How would I use type hints to maybe indicate that the name is always supposed to be some kind of string,
- 28:43and the time of day is an integer or something like this?
- 28:46You write for a date, you write a semicolon and then a date type.
- 28:55And to annotate the return value, you write an arrow, so it's minus, greater, and you write a return type.
- 29:07And actually, the main thing here is that those types don't influence the runtime.
- 29:15So they are only for tools like PyCharm and for checkers, for different linters, to validate your code, to find errors.
- 29:26Right, of course.
- 29:27Yeah, so the type hints don't really change anything about how Python works as a language or an execution environment.
- 29:34But, you know, the reason I think they're interesting is for people like you and other refactoring tools and, like you said, linters.
- 29:43What do you guys think about type hints in Python?
- 29:46You're a fan of it?
- 29:48Actually, I see it a bit controversial because, in some sense, it kills the spirit of Python.
- 29:57But I would not prefer that all the Python sources become full of type annotations because it would be not Python.
- 30:09It would be something different.
- 30:11But still, that is obvious that there is a need to annotate standard libraries.
- 30:18And in this PEP 484 proposal, there is a way to annotate types not in your source but in separate header files.
- 30:29And I think that would be beneficial if every developer of a popular library would, other than writing code,
- 30:40would make this type annotations for users of his library because it will leverage the usage
- 30:48because people would be able to use tools with code completion.
- 30:52And it would be much, much easier for them to learn the library.
- 30:56So I think this is the way to go, but it should be taken with care.
- 31:01Okay, I think that's a really good recommendation.
- 31:03Like, maybe when I go to write code, if I'm just writing an app for myself,
- 31:09maybe I don't bother to do any of these type hints.
- 31:11But maybe the libraries that I'm consuming, especially the standard library,
- 31:16if it had those annotations, then that makes it much easier for me to kind of know what to do,
- 31:24for linters to say, oh, it looks like you're passing a double, it expects an integer,
- 31:29or something like this, right?
- 31:31Yeah.
- 31:31The greatest accomplishment of PEP 484 and Python 3.5,
- 31:36in the long run, there is a standard notation.
- 31:42So it's fixed now, and it's quite advanced to express pretty much everything about types.
- 31:48Yeah, I think you're right that this is going to be a controversial feature of the language.
- 31:58But it's going to be interesting to see what happens over time, you know?
- 32:02Yeah.
- 32:03Because before, why it's important to have this standard notation,
- 32:09in PyCharm we had our own notation, actually,
- 32:12because we're dealing with the type inference,
- 32:15we had to annotate some parts of standard library on different libraries
- 32:21that could not be inferred.
- 32:25So we had to annotate them,
- 32:27and we came up with our own notation,
- 32:29and it was not very good to invent your own will.
- 32:33So the PyCharm team actually has,
- 32:37before the type hints came along,
- 32:39you had done something else that is kind of like type hints
- 32:42for the standard library,
- 32:44just so that PyCharm could work correctly.
- 32:47Is this true?
- 32:48Yeah, that's true.
- 32:49We had to do that to be able to annotate standard library
- 32:56to provide type inference in PyCharm.
- 32:58And as far as I know,
- 33:00Google had their own notation and set of type annotations.
- 33:08So now it's great that we can merge our efforts,
- 33:13create a common repository of type annotations.
- 33:18Like there is one for TypeScript, as far as I know.
- 33:21So I think that that's a move in the right direction.
- 33:24Yeah, that's definitely a move in the right direction.
- 33:26Okay.
- 33:26So yeah, it's going to be interesting to see what happens
- 33:29with this whole type hints thing,
- 33:30because in my mind,
- 33:31it's really for people like you that are building tools to help us.
- 33:35And maybe when we're writing code,
- 33:37maybe type hints are just a thing
- 33:39that make our life a little bit better
- 33:40because our tools are better.
- 33:41Yeah.
- 33:41Maybe that's how that works.
- 33:42Sure.
- 33:42In PyCharm, you can run both Python 2 and Python 3.
- 33:47You also have really good support for virtual environments
- 33:50and virtual hints and things like that, right?
- 33:53You can actually, within the tool,
- 33:54say I'm going to create a new project.
- 33:56And as part of creating this project,
- 33:58set up a virtual environment
- 34:00based on either Python 2 or Python 3 or whatever.
- 34:02What other implementations do you guys support?
- 34:05Like do you support PyPy?
- 34:07Sure, yeah.
- 34:08We do support PyPy and we support Jython and IronPython.
- 34:12Interesting.
- 34:13I didn't realize you supported IronPython.
- 34:16I guess that would be a Windows-only feature, wouldn't it?
- 34:18Yes, true.
- 34:19Yeah, since .NET, at least in that variation of it,
- 34:23only works on Windows.
- 34:24This episode is brought to you by OpBeat.
- 34:39OpBeat is application monitoring for developers.
- 34:42It's performance monitoring, error logging, release tracking, and workflow in one simple product.
- 34:46OpBeat is integrated with your code base
- 34:48and makes monitoring and debugging of your production apps much faster and your code better.
- 34:53OpBeat is free for an unlimited number of users.
- 34:56And starting today, December 1st,
- 34:58OpBeat is announcing that their Flask support is graduating from beta to a full commercial product.
- 35:03Visit opbeat.com slash Flask to get started today.
- 35:17So another thing that I think is cool is I can go to my project and go to my project settings in PyCharm,
- 35:24and it will show me, regardless of whether I'm using like a system-level Python
- 35:29or I'm using like a virtual environment that was created,
- 35:33it will show me all the packages that have been installed from pip and their versions
- 35:38and whether they're upgrades that I could potentially install and things like that, right?
- 35:43Yeah, true.
- 35:43That's right.
- 35:44I remember when I was new to Python, I found that really helpful
- 35:48because you could go there and it's got like a little search dialogue
- 35:51and you can say, find me my package and then click to install it.
- 35:54And it'll kind of automate a lot of that stuff for you.
- 35:57Yeah, and you even can install it from your editor.
- 36:00If you have any Resolve import, you can just press Alt-Enter, for example,
- 36:04and PyCharm will install this package to your active Python app.
- 36:12Yeah, yeah.
- 36:14So maybe let's talk about Alt-Enter for a little bit
- 36:16because Alt-Enter is definitely one of the things that makes PyCharm unique in my mind, right?
- 36:23So when you see problems in code or PEP 8 violations
- 36:27or maybe an import of a package that lives out on PyPI
- 36:33but is not actually installed into the environment that you have active,
- 36:36PyCharm will suggest fixes, right?
- 36:39Right. In most cases, you just press Alt-Enter and PyCharm will fix it for you.
- 36:44Yeah. So like, for example, if I say import requests
- 36:48and then I start typing things and I don't actually have,
- 36:52say I'm in a virtual environment and I don't have requests installed in there,
- 36:54it would say, hey, here's a package you're importing
- 36:58and we know about it.
- 36:59We know it lives on PyPI, but you don't have it installed.
- 37:02Hit Alt-Enter and we'll just install it for you.
- 37:04Yes, that's true.
- 37:04Or, you know, import the module if you've got it in your environment
- 37:09but it's not actually, the import keyword is missing or whatever.
- 37:12Very cool.
- 37:12Yeah.
- 37:15Yeah. I just think constant watching of, hey, how can I help you, right?
- 37:18A lot of times as programmers, we're dealing with lots of details
- 37:22and we're putting pieces together just so, right?
- 37:26Like I've got to make sure I've got this package and its dependencies installed
- 37:29and I've got to have this import keyword up here just so.
- 37:33And, you know, I think a lot of the mental juggling that we have to do can go away
- 37:39if you have some kind of editor that says, oh, we've noticed that you didn't connect this piece here.
- 37:43Hit Alt-Enter and it's connected.
- 37:46You know, like we realize you may have pip installed some library
- 37:50but you didn't type import at the top, for example.
- 37:52Yeah, that's very handy.
- 37:54I cannot even imagine how to program without it when you get used to it.
- 38:01So it's difficult.
- 38:03It totally is difficult.
- 38:05And, you know, I do a ton of Python programming, of course,
- 38:09and the other work that I do is typically in C# and Visual Studio.
- 38:14And I have exactly the same feeling when I'm over there.
- 38:16Like if I don't have V Sharp or I'm like, oh, this thing is just partly broken.
- 38:20Yeah.
- 38:20How can I continue to work in this area?
- 38:23Yeah, this is barbaric if I have to go to the top of the file and type import or, you know,
- 38:28using or whatever, depending on the language.
- 38:29Yeah, that's awesome.
- 38:31So one of the things that's super important in dynamic languages like Python is, you know,
- 38:39since there's no real compile step, there can be errors that are just not detected, right?
- 38:44Maybe even something as simple as a compiler would have detected it.
- 38:47But because it's not ever compiled, which is, you know, working out really well for Python,
- 38:53but it means those errors don't get caught.
- 38:54So typically having some other way to catch them, like unit testing, is really good.
- 38:59Sure.
- 38:59Unit testing is a...
- 39:01Do you guys have built-in support for unit testing?
- 39:03And like code coverage and stuff like that?
- 39:05Yeah, sure.
- 39:05Unit testing, I think, is a basic thing when you deal with dynamic language.
- 39:12And yes, of course, PySharp has support for unit testing.
- 39:18And we support actually different test runners, not only unit tests, but nose tests and py tests and AT tests.
- 39:25What you can do is you can run your tests from PySharp and you will see the results in a nice formatted tree.
- 39:35And you can navigate directly to source to see stack trace.
- 39:40And of course, you can debug your tests.
- 39:42You can profile them.
- 39:43You can see coverage results.
- 39:45Almost everything possible, what you're going to mention.
- 39:49So profiling is interesting.
- 39:51On show 28, we did a show about profiling Python sort of from the command line.
- 39:59And about that same time, I saw that you guys actually announced profiling support for PyCharm.
- 40:04And that's pretty excellent.
- 40:06I've not had a chance to try it yet.
- 40:09How does that work?
- 40:09Can you walk me through what I learn if I do profiling and how I do it in PyCharm?
- 40:14That's actually pretty simple to use.
- 40:17You just press the profile button for your run configuration.
- 40:21And your process is executed with cprofile injected.
- 40:28And as long as you want to capture a snapshot with your profile data, you just press the button capture snapshot.
- 40:37And it's shown in PyCharm with statistics of what method, statistics for all functions, how long did it take for them to launch.
- 40:48And actually, we have a nice visual representation in graph form where the hotspots are colored with red.
- 40:58And you can just see what is slow in your program.
- 41:04Yeah.
- 41:05The whole visual component of it, I think it's really important.
- 41:08Yeah.
- 41:08And unfortunately, just after we made the first attempt of making the integration with cprofile,
- 41:20it appeared that it's too limited and too basic to add features.
- 41:25And it was like a pity that there were no really good profiling backend for Python
- 41:35because cprofile doesn't provide you a lot of information.
- 41:40But hopefully, this summer, PyPy team has announced VM prof profiler.
- 41:47That seems to be much, much better and more advanced as cprofile.
- 41:56And we plan to integrate this one in PyCharm as long as it will support macOS X and Windows.
- 42:07But they have plans to do that and we can collaborate together to make this happen.
- 42:12Oh, yeah.
- 42:12That's going to be really excellent because it's already helpful and that'll be even better.
- 42:17Very nice.
- 42:17So another thing that you guys have support for is Vagrant.
- 42:21And I know of Vagrant, but I haven't really done anything with it.
- 42:26For everybody listening, what's Vagrant?
- 42:28Vagrant is basically a tool that eases the usage of virtual machines.
- 42:33So you can just download an image of your virtual machine and start it up and launch your process inside.
- 42:46What we have done in PyCharm is that in PyCharm, you can work with Python interpreter located inside your Vagrant virtual machine as if it is local interpreter.
- 43:00For example, your desktop is Windows and you even don't have Python there at all.
- 43:06You just take Vagrant virtual machine image.
- 43:10And in PyCharm, you add Python located in this virtual machine as a remote interpreter.
- 43:14And after that, yeah, you have all the features of the IDE.
- 43:20You can run your code, debug, run your test profile, and you have code completion.
- 43:26So everything.
- 43:27That's really cool.
- 43:28So say I'm on Windows and I don't have Python set up.
- 43:32I could have a Vagrant virtual machine running Ubuntu with Python 3 installed.
- 43:37And I could just fire that up and it will automatically copy, say, my web app files over and then kick off Python on that machine and then attach to it remotely.
- 43:47Yeah, exactly.
- 43:47Exactly.
- 43:48That's really cool.
- 43:49So you also announced Docker support.
- 43:52And in my mind, Docker is like a slightly more lightweight, modern take on that same idea.
- 43:59Can you maybe talk about what you're doing with Docker?
- 44:01Yeah, true.
- 44:03It could be seen as the same idea, but people say about it that Docker is virtualization without actual virtualization.
- 44:15So Docker is the technology of containers.
- 44:20So it relies on Linux core functionality to isolate processes from each other.
- 44:30There is a concept of Docker image.
- 44:32It's some set of configured software and files.
- 44:39And when you run this image, you get a container.
- 44:44So a container is a running Docker image.
- 44:48And if you have several containers, they can run on the same Linux machine, but they don't interfere at all.
- 44:54Every container has its own file system layer and its own network configuration.
- 45:05So they don't interfere.
- 45:07And after this container finishes its work, it's killed and removed.
- 45:14And you don't need to dispose of nothing.
- 45:18Yeah, I think Docker is really cool.
- 45:20And I think it's going to make a big...
- 45:22Yeah, sorry.
- 45:23So sorry.
- 45:23I forgot to say that the main advantage of Docker is speed.
- 45:29If you, of course, for the same purpose, you can use a virtual machine, for example, Vagrant with VirtualBox.
- 45:35But to start a virtual machine, it can take minutes sometimes.
- 45:39And starting a Docker container is just a second or a millisecond.
- 45:45So it could be really fast.
- 45:46And I think that's the main selling point.
- 45:49What we do in PyCharm is we have pretty much the same integration with Docker as with Vagrant.
- 45:58It's different under the hood, but it looks like the same.
- 46:02So you just add an interpreter inside your Docker image as a remote interpreter.
- 46:11And then you just run it or debug it or profile it.
- 46:16And PyCharm executes your container and takes all the necessary information attached to the process if you want to debug it and so on.
- 46:24That's cool.
- 46:25So what do I need to do to get started with Docker and PyCharm?
- 46:28Like, do I need to go and install Docker on my machine?
- 46:34Can I do this on OS X?
- 46:36Does it have to be done on Linux?
- 46:38What's the story there?
- 46:39You can do that on Windows and macOS X and Linux.
- 46:44All you need is to install so-called Docker toolbox.
- 46:48That is a set of software from Docker.
- 46:51It will install a Docker machine on your desktop.
- 46:54And that's pretty much it.
- 46:57You just take PyCharm Professional Edition and you go to our settings at the remote interpreter and say that it should be Docker remote interpreter.
- 47:07And then you select Python.
- 47:10For example, Python 3 Docker image and press OK.
- 47:14So, and that's it.
- 47:15You can execute your project just with this image inside the container.
- 47:22Okay, that's really cool.
- 47:23I'm going to have to play with that because that's something I've never looked into, but that sounds pretty awesome.
- 47:28So one of the things that I think is cool that PyCharm has is there's a bunch of community plugins.
- 47:36Like if I want to do like Markdown in PyCharm, there's probably a plugin I can get so that I can edit Markdown.
- 47:44Is that correct?
- 47:45Yeah, true.
- 47:46There are a lot of plugins and third-party plugins and JetBrains plugins in our plugin repository.
- 47:52Yeah, that's one of the things I like.
- 47:55And my favorite one, since I do a lot of training, but I also think is helpful even just if you're exploring parts of the tools that you don't know, is this thing called Presentation Assistant.
- 48:06Do you know that?
- 48:07Yeah, this one is nice.
- 48:08Yeah, it's nice.
- 48:09So every time you execute some kind of operation, like if I do a refactoring or a navigation or some sort of correct, you know, autocorrect, like pull in a missing import statement or something like this.
- 48:24Or even if I go to a menu and I click it, it'll always show me, it'll do like a little transparent semi or translucent overlay of what the actual keystroke that I would have had to do to make that happen.
- 48:37And so when you're learning, like you can use the menus and the buttons and stuff.
- 48:42But if you just turn on this Presentation Assistant, it'll show you like how to do this all just straight from the keyboard, right?
- 48:48I think it helped me a lot become more proficient.
- 48:51But I think it's also helpful if you're doing a training class and you hit some keystroke and something funky happens, right?
- 48:57Like, well, the students will ask, like, how did you make that happen?
- 49:00And, you know, with that thing turned on, they'll see it.
- 49:02So, yeah, that's really cool.
- 49:03Yeah, true.
- 49:05So you said there's other editors in there.
- 49:07What is built in?
- 49:09Like, so I can obviously edit Python.
- 49:11You said HTML, JavaScript.
- 49:12Does it have support for things like Angular or TypeScript or things like that?
- 49:17Yeah, we do support AngularJS and TypeScript.
- 49:23And much, much more.
- 49:25There is a support for many different JavaScript frameworks.
- 49:31Yeah, cool.
- 49:32So TypeScript's interesting.
- 49:33Do you just support, like, the editing of it?
- 49:36Or do you have some, like, compile step that'll transpile that into JavaScript so I can actually use it?
- 49:42Or do I have to do that outside of PyCharm?
- 49:43I'm actually not sure about how this works in detail because I never used TypeScript support myself and never developed it.
- 49:52But for sure you can compile TypeScript.
- 49:56But for sure you can compile TypeScript to JavaScript from PyCharm and WebStorm.
- 49:59This functionality comes into PyCharm from WebStorm.
- 50:03That's right.
- 50:04Okay, I see.
- 50:05That's part of the integration between all the different IDE teams.
- 50:09Yeah, true.
- 50:09Yeah, cool.
- 50:10So one thing you talked about earlier that I thought was pretty cool, and the first time I saw it, I'm like, wow, this really, you know, several times it saved me from, like, messing up something bad.
- 50:22Is this, you know, obviously of support for Git and subversion and so on.
- 50:26But this thing you call local history.
- 50:28Do you want to tell people about local history?
- 50:29Yeah, local history is a cool feature.
- 50:32It saved me several times from losing a portion of my work.
- 50:38It is useful not very often, but when it is, it can save you a ton of time.
- 50:44What is it basically, it's a versioning of your local changes that even when they are not committed.
- 50:51For example, when you have your local changes lost due to some broken external tool or some Git misuse, for example, when you accidentally reset everything.
- 51:05Or even if you don't have version, like, if you're one of those people like, version control, don't need that, right?
- 51:10Just start editing, right?
- 51:12I hope that there is not much of those people.
- 51:16But still, yeah, if somebody doesn't use version control, for example, what PyCharm can offer is to restore or revert your changes to some point in the history.
- 51:30So you just open local history and you see all changes that happened with your files.
- 51:38And this is a very detailed view.
- 51:40It shows differences between files.
- 51:42And yeah.
- 51:43Yeah, the way I think of it, it's kind of like Git, but the Git that you didn't set up or think about or bother to interact with, right?
- 51:52So independent of whatever real source control you're using, there's like a separate automatic autosave type of version control that you can fall back on if you need it.
- 52:01Yeah, that's really helpful.
- 52:03Like you said, I probably use that once every two months.
- 52:05But when I do, I'm like, oh, thank goodness.
- 52:06Yeah, yeah, yeah.
- 52:07Maybe even less, but I still really appreciate it when it works.
- 52:13We're kind of getting towards the end of the show a little bit.
- 52:15And one of the things I think is probably more interesting than just the details.
- 52:20I wanted to talk about some of the details because there's just, and we just barely touched on all the cool things that I think PyCharm can do.
- 52:28I wanted to talk about these so that people out there are like, there's this tool that can help so much.
- 52:34Even though maybe it starts slower than Vim or Emacs or Sublime Text, you know, if you're willing to wait like two seconds, that's not really that long.
- 52:42You get this great thing to help you write code and work on, especially large projects.
- 52:47You know, one of the things I hear a lot, obviously there's a bunch of people that like tools that help them a lot, but there's also people that just want super lightweight.
- 52:58So if somebody came to you and said, Dimitri, you know, I think what you guys built is cool, but it's just not for me.
- 53:05I don't really need an IDE.
- 53:07I work on these big Python projects, but I've never needed an IDE.
- 53:11I just feel like they're in my way.
- 53:13Like, what would you say, give PyCharm a chance or think about some kind of IDE that's there to sort of support them?
- 53:19First of all, I just offer a person to try, but if he has already tried.
- 53:26And for some reason find that he feels more at home with Vim.
- 53:33So I don't know.
- 53:35It's also okay.
- 53:37I think that everybody choose their own way to develop applications.
- 53:44I think the right approach is to try different things.
- 53:48So it's not very effective when you're stuck with something and you don't try different things.
- 53:55I think even with somebody, programs uses PyCharm extensively.
- 54:02I think it's okay also to try different editors.
- 54:05You can find different approaches and you can compare.
- 54:09So it's just better to try.
- 54:12So that's my philosophy.
- 54:14As I said before, I've done that with different languages.
- 54:17So when I wanted to pick up dynamic language, I just tried different things.
- 54:22So I think the same thing applies to IDs and editors.
- 54:28If you look at any of the individual features, I don't think there's a single feature that would convince anybody that, hey, I should try this tool.
- 54:36If they're kind of like, you know, IDs are not for me, right?
- 54:40If I told you, hey, this thing has local history, they're like, yeah, I use Git.
- 54:44No problem.
- 54:45Oh, this thing has code coverage.
- 54:47Well, I can use, you know, coverage.py and get that.
- 54:51And I think it's the bringing it all together.
- 54:55Like all, no single feature is like, they're great, but they're not that amazing.
- 54:59But, you know, 20 or 50 or 100 of them all at the same time is when it starts to be really an interesting tool for you when you're working in ID.
- 55:08So that's kind of my view of the benefits is no single feature is going to really make it worthwhile.
- 55:16But taken as a whole, they start to really add up.
- 55:18Yeah, true.
- 55:20I agree with you.
- 55:21That's true.
- 55:22There's always a couple of questions I ask my guests before we sort of wrap up the show.
- 55:29What's your favorite PyPI package or maybe project out on GitHub or something that is cool, maybe not everyone knows about, that you'd like to point out to the community?
- 55:38Actually, my favorite is coverage.py.
- 55:43I like it very much and I contributed to it at some moment unintentionally.
- 55:51But it's very well-known package, actually.
- 55:56If to point something to people, I would notice TOX.
- 56:01I think that's very, very useful when you want to test your Python projects on different environments, in different Pythons, for example.
- 56:10And yeah, I've heard about such a project called DTOX, which is basically TOX, but executes your TOX tests in parallel.
- 56:21I never tried it, but I think the idea is cool, so maybe it's worth trying.
- 56:26Yeah, that's pretty awesome.
- 56:28So, coverage PY, TOX, T-O-X?
- 56:32Yes.
- 56:32And then DTOX.
- 56:33Yeah, okay.
- 56:34Very nice.
- 56:35Well, thanks for recommendations.
- 56:36And then, I think you might be biased on this one, but I always ask everyone what their favorite editor is.
- 56:41Are you an Emacs person, a PyCharm person, a Vim, Sublime Text?
- 56:45Yeah, it is.
- 56:46It is PyCharm, of course.
- 56:48Of course.
- 56:49All right.
- 56:49That's awesome.
- 56:50So, before we go, do you have any, like, calls to actions, things you'd like people to do, know about?
- 56:57Try PyCharm if you did not yet, if you haven't.
- 57:03And please say us what you think.
- 57:06So, we do listen to our users.
- 57:09And the things that our users tell us are very important.
- 57:16Okay.
- 57:17Yeah, that's cool.
- 57:18If we have feedback for you, how do we give it to you?
- 57:21There are different channels.
- 57:23You can submit issues and feature requests to our tracker.
- 57:26Or you can write our support.
- 57:29There is a forum.
- 57:32I would prefer to write directly to issue tracker and vote for features because there are a lot of features and feature requests in our tracker already.
- 57:41And actually, we do look at votes when we consider features for the next version to be included in the roadmap.
- 57:53Okay.
- 57:54Excellent.
- 57:54Well, it's been really fun to talk to you about PyCharm.
- 57:57It's quite a project you guys put together there.
- 57:59Thank you.
- 58:01It was a pleasure to talk with you.
- 58:02Yeah.
- 58:03Thanks for being on the show.
- 58:03See you later.
- 58:05This has been another episode of Talk Python To Me.
- 58:08Today's guest was Dmitry Trofimov.
- 58:10And this episode has been sponsored by Hired and OpBeat.
- 58:12Thank you guys for supporting the show.
- 58:15Hired wants to help you find your next big thing.
- 58:17Visit Hired.com slash Talk Python To Me to get five or more offers with salary and equity presented right up front.
- 58:24And a special listener signing bonus of $4,000.
- 58:26OpBeat is mission control for your Python web applications.
- 58:31Keep an eye on errors, performance, profiling, and more for your Django and Flask web app.
- 58:36Tell them thanks for supporting the show on Twitter where they are at OpBeat.
- 58:40Did you know you can personally support the show too?
- 58:42Just visit Patreon.com slash mkennedy and join over 60 listeners who contribute between $1 and $2 per episode.
- 58:50You can find the links from the show at talkpython.fm/episodes slash show slash 36.
- 58:56And be sure to subscribe to the show.
- 58:58Open your favorite podcatcher and search for Python.
- 59:01We should be right at the top.
- 59:02You can also find the iTunes and direct RSS feeds in the footer of the website.
- 59:06Our theme music is Developers, Developers, Developers by Corey Smith who goes by Smix.
- 59:11You can hear the entire song on talkpython.fm.
- 59:14This is your host, Michael Kennedy.
- 59:16Thanks again for listening.
- 59:18Smix takes it out of here.
- 59:20Stating with my voice.
- 59:22There's no norm that I can feel within.
- 59:24Haven't been sleeping.
- 59:25I've been using lots of rest.
- 59:27I'll pass the mic back to who rocked it best.
- 59:29I'll pass the mic back to who rocked it best.
- 59:34I'll pass the mic back to who rocked it best.
- 59:36I'll pass the mic back to who rocked it best.
- 59:38I'll pass the mic back to who rocked it best.
- 59:39I'll pass the mic back to who rocked it best.
- 59:41I'll pass the mic back to who rocked it best.