Learn Python with Talk Python's 270 hours of courses

#36: Python IDEs with the PyCharm team Transcript

Recorded on Wednesday, Nov 11, 2015.

00:00 As a software developer, what's the most important application on your computer?

00:03 If your answer is Microsoft Outlook, my heart goes out to you. Stay strong. But for most of us,

00:09 it's probably a toss-up between our web browser and code editors. And for editors, there's basically

00:14 two camps. There's the lightweight, smart text editors such as Vim, Emacs, and Sublime Text,

00:20 and heavyweight but highly functional IDEs such as PyDev and PyCharm. This week, you'll meet

00:26 Dmitry Trophimov, who's one of the main developers behind one of my favorite editors, PyCharm.

00:32 This is episode number 36 of Talk Python to Me, recorded November 11, 2015.

00:53 Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the

01:07 ecosystem, and the personalities. This is your host, Michael Kennedy. Follow me on Twitter,

01:12 where I'm @mkennedy. Keep up with the show and listen to past episodes at talkpython.fm,

01:17 and follow the show on Twitter via at talkpython. This episode is brought to you by Hired and OpBeat.

01:23 Thank them for supporting the show on Twitter via at Hired underscore HQ and at OpBeat.

01:29 Hi, everyone. Thanks for listening to this episode. I have a few quick comments before we get to the

01:34 interview. Some of the features we talk about are better understood visually rather than described

01:40 in audio. And for that reason and others, I decided to write a blog post visually highlighting

01:44 some of these concepts. This post is called Nine Reasons You Should Be Using PyCharm. If you're

01:49 interested, check it out at bit.ly slash whypycharm. Last but not least, the PyCharm team at JetBrains

01:56 offered to give away three annual subscriptions to PyCharm Professional. I'll do the drawing Monday,

02:02 December 7th. That's a week from the release date of this podcast. All you have to do to be eligible is

02:07 become a friend of the show. Visit talkpython.fm and click Friends of the Show in the navigation

02:11 bar and sign up. Now let's get on to the show. Let me introduce Dmitry. Dmitry Tarfimov currently

02:18 leads the development of PyCharm, a popular Python IDE by JetBrains. Dmitry is passionate about

02:24 automation and software tooling. Before PyCharm, he implemented many different tools for a variety

02:29 of companies, including a visual site scraper generator, a model to code mapper, and even a

02:36 generator for hardware used in submarines. In his spare time, he's a committed running enthusiast

02:41 and triathlete. Dmitry lives in Munich, Germany. Dmitry, welcome to the show.

02:47 Hi, Mike.

02:48 Hi. I'm really excited to talk about PyCharm and JetBrains and editors and tooling for Python

02:55 with you today. It's going to be great.

02:56 Yeah, sure. Thanks for inviting me.

03:00 Yeah. So before we dig into all that, let's start at the beginning. How'd you get into

03:05 programming in Python? What's your story?

03:06 That was long ago, actually. My first programming experience was when I was something about seven

03:15 years old. Back then, I had a ZX Spectrum computer and it was possible to program it with Sinclair

03:22 BASIC. So I read a book about programming in BASIC and found some source program inside the book.

03:30 And this program is supposed to do something cool. So I sit down and typed all the program into the

03:37 computer, actually without full understanding how does it work. I was seven and I typed quite slow.

03:43 So it took like, I don't know, like an hour or something to type that program in. And after I

03:48 finished, I felt relief. But then when I tried to run it, it just failed. You know, so it didn't start.

03:56 And I had no clue why. The error message was totally unclear for me. And it was very frustrating. Nobody

04:02 could help me because I was at home alone. And I felt like I was betrayed by the book, which I trusted.

04:10 So yeah, maybe if I have started to learn programming today with Python and PyCharm, for example, I would have

04:18 much more pleasant experience. At least Python is a much, much better language. And PyCharm would hint

04:25 me about which error I had and which is more important to where it was. So yeah, maybe. But my programming

04:31 story didn't end there, obviously. Several years after I went into a computer class where I learned how to

04:37 program Pascal, there was a brilliant teacher and Turbo Pascal IDE. And I learned step by step. And

04:45 at some point, I realized that I can do computer programming in Pascal. Maybe that's why I'm a fan

04:53 of IDEs because of Turbo Pascal. I don't know. Maybe that could be an imprint for me.

04:59 Was it a young, impressionable programmer?

05:02 Yeah. Awesome. So how'd you go from Pascal to Python?

05:07 Actually, from Pascal, I converted to Java directly. So it was C and Assembler in the middle somewhere.

05:17 And then I've been doing a lot of Java. And at some point, I realized that I need to have a scripting

05:27 language in my toolbox. But I couldn't choose which one. And I wrote one small project in several

05:35 languages just to be able to compare them. I took Groovy, Ruby, Python, and Perl. Perl was a total disaster.

05:42 But others were more or less equal. But I remember my impression from Python. That felt pretty much like

05:53 all other languages. But at the same time, very different from them. And everything felt

06:00 reasonable and easy there. And I did like that. So since that, I used Python from time to time.

06:09 And then I joined JetBrains to make a new IDE for Python called PyCharm. It was in early beta. And so I'm

06:20 working on it till now. It was five and a half years ago.

06:24 That's really excellent. And I've never heard people choosing a language the way you just described

06:30 it. But it's such a good idea to say, look, I'm interested in learning this type of language. And it

06:38 looks like there's these choices, four or five or six or whatever. And the idea of writing a simple

06:43 program in each and then comparing the experience, that's really cool. I think more people should adopt that.

06:49 Yeah, I gained a lot of experience doing that. And it was fun.

06:55 Yeah, I always kind of just gone with, you know, do the research, see what's popular, what are the capabilities,

07:01 what 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,

07:08 do a bunch together and compare and contrast. That's cool. PyCharm. Before we get into PyCharm,

07:15 maybe, you know, when I think about the company that makes PyCharm, JetBrains, where you work,

07:20 I see you guys as one of the premier, if not the premier, developer tool companies out there.

07:29 Can you maybe just talk a little bit about what is JetBrains, what type of apps and products you build?

07:35 Yeah, sure. JetBrains is a company that makes tools for software developers, as you said. And

07:45 currently, there are more than 500 people working there. And we have offices in St. Petersburg,

07:51 Munich, Prague, and Boston. So the two biggest development spots are in St. Petersburg and Munich.

08:00 And yeah, we make tools for software developers. And actually being ourselves software developers,

08:08 this allows us to make really good tools. You know, there is a culture in JetBrains that everybody

08:15 writes a code. Even our sales, they do program a lot, actually. So the company grows, but this is very,

08:26 this is amazing that this culture stays. And talking about our products, of course, we have

08:34 many ideas like PyCharm, IntelJ IDEA, RubyMine, PHPStorm, WebStorm, CLion, AppCode. So for

08:43 basically for most major and popular languages, even if there is no IDE for a language, there should be a

08:53 plugin that is maintained by JetBrains or third parties. So the IntelJ platform is quite, quite

09:00 diverse and solid. Yeah, that's, that seems to be kind of the foundation of most of your IDEs. I kind of see

09:08 you guys as the company that looks at what other software development systems are doing or build

09:16 that and fixing the problems. Like, you know, Microsoft makes Visual Studio and it has, it's not bad, but it

09:22 has these issues. And so you guys make ReSharper. Yeah, exactly. Exactly. And then, you know, Apple makes,

09:29 Apple makes Xcode, but you're like, oh, this is not so great.

09:32 Yeah.

09:34 Yeah.

09:36 Yeah.

09:38 Yeah.

09:40 Yeah.

09:40 Yeah.

09:42 Yeah.

09:50 Yeah.

09:52 Yeah.

09:52 Yeah.

09:52 Yeah.

10:02 Yeah.

10:02 Yeah.

10:02 Yeah.

10:04 Yeah.

10:04 Yeah.

10:06 If they're willing to have the time and energy and interest to actually learn the tools.

10:12 Tools are very important.

10:14 I 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:26 So we have a range of server-side tools.

10:28 It is continuous integration called TeamCity.

10:33 There is a bug tracker called Utrek.

10:36 And there is a code review tool called AppSource.

10:40 And we even make our own GVM programming language called Kotlin.

10:43 So every area of software development, we try to make a product in this area.

10:50 And actually, we use this product.

10:52 And this allows us to make it good.

10:55 Yeah, if you don't use the thing you're building, then you just...

10:58 Yeah.

10:59 It's just not good, right?

11:01 You have to use the thing that you're building to make it truly excellent.

11:04 Sure.

11:05 Sure.

11:06 All right.

11:06 So like I said, I think most people know PyCharm.

11:09 But maybe give us the 30-second elevator pitch.

11:12 What is it?

11:13 PyCharm is an IDE for Python.

11:15 There are two editions of PyCharm.

11:18 The first is PyCharm Community Edition that is free and open source.

11:23 And it provides all basic functionality without any limitations.

11:27 And there is a professional edition.

11:30 It's not free, but it has many features, especially for professional development, like support for web technologies.

11:38 There's many languages, like HTML, CSS, JavaScript, different JavaScript frameworks, Python web frameworks, like Django, Flask, Pyramid, Web2Py.

11:48 And a lot of functionality, like working with databases and working with code on remote environments and profiling code coverage.

11:59 So this is all in professional edition.

12:03 Yeah.

12:04 And 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:10 So I'm interested to ask you about it.

12:13 One of the things that's cool about PyCharm, I think, is that it's really cross-platform.

12:18 Yeah, that's true.

12:20 PyCharm, as well as IntelliJ platform, is implemented in Java.

12:25 So it basically runs everywhere where GVM can run.

12:30 There are some parts that are native, but they are not essential for the main functionality, actually.

12:41 And there are three operational systems that are officially supported.

12:46 It is macOS X, Linux, and Windows.

12:50 But actually, I know that our users even managed to run PyCharm on some environments like Raspberry Pi.

12:58 And, 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:07 But unfortunately, embedded terminal is not working.

13:10 So, yeah.

13:11 So in that case, we just answer, okay, sorry for that.

13:16 But embedded terminal is also open source.

13:19 So you can port it to Raspberry Pi, send us a pull request, and something like that.

13:24 Yeah, that's really funny.

13:27 The fact that it runs on Raspberry Pi at all is pretty awesome.

13:30 People are saying, oh, this part doesn't work.

13:33 It's like, did you really expect it all to work?

13:35 But yeah, that's cool.

13:37 That's cool.

13:37 I'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:45 Yeah, that's crazy.

13:46 That's crazy.

13:46 That's crazy.

13:47 We just added support for Docker in the latest version.

13:52 And so it was also a response like, oh, that's great.

13:57 But what I want is to run PyCharm in Docker and then run containers from PyCharm.

14:04 Yeah, it was, it's very nice.

14:06 Actually, I don't understand this scenario yet, but I think I will try it myself.

14:12 Yeah, it's probably just because you can, right?

14:16 But when you guys announced support for Docker, that's like, you can create Docker containers that run your apps,

14:22 not you can run PyCharm within Docker containers.

14:25 But, you know, I guess someone got that working, which is cool.

14:28 Yeah.

14:29 So you said there's like 500 people at JetBrains.

14:32 Yeah.

14:34 Yeah, how many people are actually part of the PyCharm initiative?

14:38 There are 14 people working directly on PyCharm.

14:43 PyCharm is built upon Intel J Platform.

14:46 So if we count those people, so it adds like from 50 to 60 people more that are contributing directly to Platform.

14:58 But actually, that is not very easy to count because there are a lot of people who work on different IDs.

15:04 For example, WebStorm.

15:07 All functionality of WebStorm comes with PyCharm Professional Edition.

15:12 So do we count as an Intel J Platform or not?

15:14 So that's difficult to measure.

15:18 Yeah, there's a lot of intersection between the different IDE teams like AppCode and WebStorm.

15:23 So, yeah, I can see that that's tricky.

15:25 Okay.

15:26 So it's a pretty large team, full-time team working on PyCharm, yeah?

15:31 Yeah.

15:32 Yeah.

15:32 By the way, we're proud that we have a proportion of girls and guys like 50-50 almost in our team.

15:45 That is really excellent.

15:46 Cheers to you guys.

15:48 That's great.

15:48 So when I run PyCharm, you know, as Sid, it's built on Intel J.

15:54 Like 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:05 Actually, all the Intel J Platform is built that way that it is a language agnostic.

16:10 So it's like a framework upon which you can write a parser and inspections.

16:16 But there is actually no that strict separation.

16:25 When you're getting started, there's different ways to get started in Python, right?

16:29 One way is to just type Python in your terminal or command prompt and then start entering stuff into the REPL.

16:36 That's probably the least productive thing you can do, although it's the easiest to get started, right?

16:41 Like you can create variables and import modules and things like that, right?

16:46 And 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:58 but they don't necessarily help you understand the standard library and things like that necessarily.

17:05 And then you've got PyCharm, which can help you with the language.

17:09 Where do you think people should start?

17:12 What are your thoughts?

17:13 Is there a lot of value in starting sort of with no support?

17:19 Or 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:27 I think that the supportive environment is beneficial, actually.

17:33 It even can help you to learn the language and it assists you.

17:38 So I would prefer to start with an IDE.

17:44 You know, we're both sort of self-selecting in that sense as well.

17:48 But 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:58 But, 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:11 As a new person.

18:12 Yeah, sure.

18:13 And you do memorize them, actually.

18:15 Because it just takes less time when you see it in code completion, not in Google, for example, or documentation.

18:24 So you get information faster and you do memorize it.

18:29 There's some cool plugins that I want to come back to later to talk about that as well.

18:33 But another thing that's really challenging can be creating new types of projects.

18:39 So 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:51 Can you talk about, like, sort of what the types of projects you can create in PyCharm as, like, starter projects?

18:58 Yeah, sure.

19:00 It's mostly all type of Python web framework.

19:05 So it is Django, Flask, Pyramid, Web2Py, and also all kinds of pure web projects.

19:17 Actually, the main project that you can create in PyCharm is pure Python projects.

19:21 So you can just start with that, for example, and then you can add everything that you want.

19:25 If you know that you are going to develop Django projects, then it's better to start with Django projects from the start.

19:31 Because everything will be configured and you will have a template.

19:35 Yeah, I think one of the things that people struggle with, and as you get experience, you forget that it's actually really hard.

19:43 You're just like, oh, that's a little bit of extra work.

19:46 But in the beginning, it can be really hard.

19:49 So, you know, suppose I want to get started with Pyramid.

19:51 Right?

19:53 Well, 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:04 I have to pip install Pyramid and the various dependencies.

20:10 And 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:21 And that will generate a whole bunch of stuff, a whole project structure.

20:24 And then I've got to run, you know, the setup configuration stuff because it's all treated like packages and so on.

20:31 And I think people that are experienced with Python sort of forget how non-obvious that part is, right?

20:38 But having it just as a thing you click, I'd like a new Pyramid app, and all that stuff happens.

20:42 You know, that's really cool.

20:44 I 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:07 This episode is brought to you by Hired.

21:09 Hired is a two-sided, curated marketplace that connects the world's knowledge workers to the best opportunities.

21:16 Each 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:25 Typically, candidates receive five or more offers in just the first week, and there are no obligations ever.

21:31 Sounds pretty awesome, doesn't it?

21:33 Well, did I mention there's a signing bonus?

21:36 Everyone who accepts a job from Hired gets a $2,000 signing bonus.

21:39 And as Talk Python listeners, it gets way sweeter.

21:44 Use the link Hired.com slash Talk Python To Me, and Hired will double the signing bonus to $4,000.

21:51 Opportunity's knocking.

21:53 Visit Hired.com slash Talk Python To Me and answer the call.

22:05 True.

22:06 True.

22:06 True.

22:07 True.

22:07 True.

22:07 True.

22:07 True.

22:07 But also, you can start, you're going to go step-by-step with PyCharm.

22:11 So you can just create pure Python project, or you can just open a directory and create file there, and then start typing something.

22:21 And when you have a user's name, PyCharm will offer you to install this package from PyPI, so you can do that.

22:28 And it's not that strict that if you develop a pyramid, you need to start from a pyramid project and generate everything.

22:39 Right.

22:39 That's true.

22:40 So it's possible that it's helpful for you, but if you already have a pyramid website, you can just grab the directory.

22:46 Yeah, yeah.

22:46 Sure.

22:47 Throw it on PyCharm, then it'll sort of be as if you had created it, right?

22:50 Yeah.

22:50 PyCharm will understand the structure of your project so that it is actually a pyramid project and will configure pretty much of everything.

23:00 I don't really want to necessarily just go through all the features of PyCharm, but maybe you could talk about a couple favorites.

23:08 Like, for example, I think my two favorite features in PyCharm are the sort of smart IntelliSense, right?

23:17 So 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:25 So that sort of IntelliSense is really cool.

23:28 And then the sort of navigation stuff, right?

23:32 So I can say, oh, here's the function being called on some object.

23:35 Take me to its implementation.

23:37 What are your favorites?

23:38 Actually, I also like IntelliSense and navigation, but my favorite is definitely the debugger.

23:48 I 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:58 Yeah.

23:58 So, 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:13 I like this part most.

24:16 Actually, we have quite good version control support, JIT support, for example.

24:25 So it's not bad.

24:26 I would even say amazing, but it could be considered a bit immodest for a JIT brain person.

24:31 But yes, I like our JIT integration.

24:33 And my favorite feature there is ability to compare different branches in JIT log.

24:39 Okay.

24:40 Yeah, that's pretty awesome.

24:40 Local history.

24:41 I'm sorry.

24:42 So for interrupting, local history is amazing also.

24:45 Yeah, I was definitely going to say, if you're talking about version control, this idea of local history is cool.

24:50 Let's take a step back for a minute and dig into the other ones just for a moment.

24:55 And then I want to talk about local history because that's really awesome.

24:57 So how do you guys do IntelliSense for Python?

25:02 Like how does that work in a dynamic language?

25:07 How does it work?

25:08 IntelliSense in PyCharm works that way that when you write your code in PyCharm, it's parsed in real time.

25:16 And analyzed this way that PyCharm tries to understand what is your goal and how to help you the best way.

25:25 So it offers you code completion.

25:29 It reformats your code.

25:32 It inserts correct indentation, for example.

25:36 So it highlights, of course it highlights syntax errors.

25:41 But beyond that, it also tries to warn you about some errors that are not so obvious.

25:49 So 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:04 Well, more what I'm thinking is, you know, when I write Python code, I don't ever declare a type.

26:10 I don't say, you know, int x equals 7.

26:13 I just say x equals 7.

26:15 And, you know, sometimes it's really obvious, right, when you declare it just like that.

26:20 But 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:29 And it seems like you guys do a really good job of actually knowing what that's supposed to be.

26:32 Yeah, we try to infer types for variables.

26:38 And we do it quite, quite good.

26:40 So it's called data flow analysis.

26:45 When you write your code inside a function or a method, we trace the types of all the variables.

26:53 Yeah, I think that's really awesome.

26:57 And 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:07 it'll sort of then suggest it later as IntelliSense, but it doesn't really understand, like, the way the whole program fits together.

27:15 It's missing a lot of the cool stuff that you guys have there.

27:18 I know you just announced support for Python 3.5.

27:22 True.

27:22 And that includes this thing called Python Type Hints.

27:27 Yeah, actually, PyCharm team participated, was involved, actually, in the process of elaboration of this proposal.

27:37 That's really cool.

27:40 Maybe before I ask you a question about it, maybe you could tell everyone what those are.

27:45 There is a PEP 484, so-called, this is initiative adding a declaration of typing into Python.

27:56 So before there was no standard way to annotate types.

28:02 It was something starting from Python 3, but it was very limited and couldn't be used extensive.

28:11 In Python 3.5, Gubito Warren Rossum came up with a proposal of elaboration of standard notation for annotating types for arguments and variables.

28:26 Yeah, so maybe an example would be I've got a function, sayHello, right?

28:33 Maybe the function is called sayHello, and you give it a name and a time of day.

28:38 How would I use type hints to maybe indicate that the name is always supposed to be some kind of string,

28:43 and the time of day is an integer or something like this?

28:46 You write for a date, you write a semicolon and then a date type.

28:55 And to annotate the return value, you write an arrow, so it's minus, greater, and you write a return type.

29:07 And actually, the main thing here is that those types don't influence the runtime.

29:15 So they are only for tools like PyCharm and for checkers, for different linters, to validate your code, to find errors.

29:26 Right, of course.

29:27 Yeah, so the type hints don't really change anything about how Python works as a language or an execution environment.

29:34 But, you know, the reason I think they're interesting is for people like you and other refactoring tools and, like you said, linters.

29:43 What do you guys think about type hints in Python?

29:46 You're a fan of it?

29:48 Actually, I see it a bit controversial because, in some sense, it kills the spirit of Python.

29:57 But I would not prefer that all the Python sources become full of type annotations because it would be not Python.

30:09 It would be something different.

30:11 But still, that is obvious that there is a need to annotate standard libraries.

30:18 And in this PEP 484 proposal, there is a way to annotate types not in your source but in separate header files.

30:29 And I think that would be beneficial if every developer of a popular library would, other than writing code,

30:40 would make this type annotations for users of his library because it will leverage the usage

30:48 because people would be able to use tools with code completion.

30:52 And it would be much, much easier for them to learn the library.

30:56 So I think this is the way to go, but it should be taken with care.

31:01 Okay, I think that's a really good recommendation.

31:03 Like, maybe when I go to write code, if I'm just writing an app for myself,

31:09 maybe I don't bother to do any of these type hints.

31:11 But maybe the libraries that I'm consuming, especially the standard library,

31:16 if it had those annotations, then that makes it much easier for me to kind of know what to do,

31:24 for linters to say, oh, it looks like you're passing a double, it expects an integer,

31:29 or something like this, right?

31:31 Yeah.

31:31 The greatest accomplishment of PEP 484 and Python 3.5, in the long run, there is a standard notation.

31:42 So it's fixed now, and it's quite advanced to express pretty much everything about types.

31:48 Yeah, I think you're right that this is going to be a controversial feature of the language.

31:58 But it's going to be interesting to see what happens over time, you know?

32:02 Yeah.

32:03 Because before, why it's important to have this standard notation, in PyCharm we had our own notation, actually,

32:12 because we're dealing with the type inference, we had to annotate some parts of standard library on different libraries

32:21 that could not be inferred.

32:25 So we had to annotate them, and we came up with our own notation, and it was not very good to invent your own will.

32:33 So the PyCharm team actually has, before the type hints came along, you had done something else that is kind of like type hints

32:42 for the standard library, just so that PyCharm could work correctly.

32:47 Is this true?

32:48 Yeah, that's true.

32:49 We had to do that to be able to annotate standard library to provide type inference in PyCharm.

32:58 And as far as I know, Google had their own notation and set of type annotations.

33:08 So now it's great that we can merge our efforts, create a common repository of type annotations.

33:18 Like there is one for TypeScript, as far as I know.

33:21 So I think that that's a move in the right direction.

33:24 Yeah, that's definitely a move in the right direction.

33:26 Okay.

33:26 So yeah, it's going to be interesting to see what happens with this whole type hints thing,

33:30 because in my mind, it's really for people like you that are building tools to help us.

33:35 And maybe when we're writing code, maybe type hints are just a thing that make our life a little bit better

33:40 because our tools are better.

33:41 Yeah.

33:41 Maybe that's how that works.

33:42 Sure.

33:42 In PyCharm, you can run both Python 2 and Python 3.

33:47 You also have really good support for virtual environments and virtual hints and things like that, right?

33:53 You can actually, within the tool, say I'm going to create a new project.

33:56 And as part of creating this project, set up a virtual environment based on either Python 2 or Python 3 or whatever.

34:02 What other implementations do you guys support?

34:05 Like do you support PyPy?

34:07 Sure, yeah.

34:08 We do support PyPy and we support Jython and IronPython.

34:12 Interesting.

34:13 I didn't realize you supported IronPython.

34:16 I guess that would be a Windows-only feature, wouldn't it?

34:18 Yes, true.

34:19 Yeah, since .NET, at least in that variation of it, only works on Windows.

34:24 This episode is brought to you by OpBeat.

34:39 OpBeat is application monitoring for developers.

34:42 It's performance monitoring, error logging, release tracking, and workflow in one simple product.

34:46 OpBeat is integrated with your code base and makes monitoring and debugging of your production apps much faster and your code better.

34:53 OpBeat is free for an unlimited number of users.

34:56 And starting today, December 1st, OpBeat is announcing that their Flask support is graduating from beta to a full commercial product.

35:03 Visit opbeat.com slash Flask to get started today.

35:17 So another thing that I think is cool is I can go to my project and go to my project settings in PyCharm,

35:24 and it will show me, regardless of whether I'm using like a system-level Python

35:29 or I'm using like a virtual environment that was created, it will show me all the packages that have been installed from pip and their versions

35:38 and whether they're upgrades that I could potentially install and things like that, right?

35:43 Yeah, true.

35:43 That's right.

35:44 I remember when I was new to Python, I found that really helpful because you could go there and it's got like a little search dialogue

35:51 and you can say, find me my package and then click to install it.

35:54 And it'll kind of automate a lot of that stuff for you.

35:57 Yeah, and you even can install it from your editor.

36:00 If you have any Resolve import, you can just press Alt-Enter, for example,

36:04 and PyCharm will install this package to your active Python app.

36:12 Yeah, yeah.

36:14 So maybe let's talk about Alt-Enter for a little bit because Alt-Enter is definitely one of the things that makes PyCharm unique in my mind, right?

36:23 So when you see problems in code or PEP8 violations or maybe an import of a package that lives out on PyPI

36:33 but is not actually installed into the environment that you have active,

36:36 PyCharm will suggest fixes, right?

36:39 Right. In most cases, you just press Alt-Enter and PyCharm will fix it for you.

36:44 Yeah. So like, for example, if I say import requests and then I start typing things and I don't actually have,

36:52 say I'm in a virtual environment and I don't have requests installed in there,

36:54 it would say, hey, here's a package you're importing and we know about it.

36:59 We know it lives on PyPI, but you don't have it installed.

37:02 Hit Alt-Enter and we'll just install it for you.

37:04 Yes, that's true.

37:04 Or, you know, import the module if you've got it in your environment but it's not actually, the import keyword is missing or whatever.

37:12 Very cool.

37:12 Yeah.

37:15 Yeah. I just think constant watching of, hey, how can I help you, right?

37:18 A lot of times as programmers, we're dealing with lots of details and we're putting pieces together just so, right?

37:26 Like I've got to make sure I've got this package and its dependencies installed

37:29 and I've got to have this import keyword up here just so.

37:33 And, you know, I think a lot of the mental juggling that we have to do can go away

37:39 if you have some kind of editor that says, oh, we've noticed that you didn't connect this piece here.

37:43 Hit Alt-Enter and it's connected.

37:46 You know, like we realize you may have pip installed some library but you didn't type import at the top, for example.

37:52 Yeah, that's very handy.

37:54 I cannot even imagine how to program without it when you get used to it.

38:01 So it's difficult.

38:03 It totally is difficult.

38:05 And, you know, I do a ton of Python programming, of course, and the other work that I do is typically in C Sharp and Visual Studio.

38:14 And I have exactly the same feeling when I'm over there.

38:16 Like if I don't have V Sharp or I'm like, oh, this thing is just partly broken.

38:20 Yeah.

38:20 How can I continue to work in this area?

38:23 Yeah, this is barbaric if I have to go to the top of the file and type import or, you know,

38:28 using or whatever, depending on the language.

38:29 Yeah, that's awesome.

38:31 So one of the things that's super important in dynamic languages like Python is, you know,

38:39 since there's no real compile step, there can be errors that are just not detected, right?

38:44 Maybe even something as simple as a compiler would have detected it.

38:47 But because it's not ever compiled, which is, you know, working out really well for Python,

38:53 but it means those errors don't get caught.

38:54 So typically having some other way to catch them, like unit testing, is really good.

38:59 Sure.

38:59 Unit testing is a...

39:01 Do you guys have built-in support for unit testing?

39:03 And like code coverage and stuff like that?

39:05 Yeah, sure.

39:05 Unit testing, I think, is a basic thing when you deal with dynamic language.

39:12 And yes, of course, PySharp has support for unit testing.

39:18 And we support actually different test runners, not only unit tests, but nose tests and py tests and AT tests.

39:25 What you can do is you can run your tests from PySharp and you will see the results in a nice formatted tree.

39:35 And you can navigate directly to source to see stack trace.

39:40 And of course, you can debug your tests.

39:42 You can profile them.

39:43 You can see coverage results.

39:45 Almost everything possible, what you're going to mention.

39:49 So profiling is interesting.

39:51 On show 28, we did a show about profiling Python sort of from the command line.

39:59 And about that same time, I saw that you guys actually announced profiling support for PyCharm.

40:04 And that's pretty excellent.

40:06 I've not had a chance to try it yet.

40:09 How does that work?

40:09 Can you walk me through what I learn if I do profiling and how I do it in PyCharm?

40:14 That's actually pretty simple to use.

40:17 You just press the profile button for your run configuration.

40:21 And your process is executed with cprofile injected.

40:28 And as long as you want to capture a snapshot with your profile data, you just press the button capture snapshot.

40:37 And it's shown in PyCharm with statistics of what method, statistics for all functions, how long did it take for them to launch.

40:48 And actually, we have a nice visual representation in graph form where the hotspots are colored with red.

40:58 And you can just see what is slow in your program.

41:04 Yeah.

41:05 The whole visual component of it, I think it's really important.

41:08 Yeah.

41:08 And unfortunately, just after we made the first attempt of making the integration with cprofile,

41:20 it appeared that it's too limited and too basic to add features.

41:25 And it was like a pity that there were no really good profiling backend for Python

41:35 because cprofile doesn't provide you a lot of information.

41:40 But hopefully, this summer, PyPy team has announced VM prof profiler.

41:47 That seems to be much, much better and more advanced as cprofile.

41:56 And we plan to integrate this one in PyCharm as long as it will support macOS X and Windows.

42:07 But they have plans to do that and we can collaborate together to make this happen.

42:12 Oh, yeah.

42:12 That's going to be really excellent because it's already helpful and that'll be even better.

42:17 Very nice.

42:17 So another thing that you guys have support for is Vagrant.

42:21 And I know of Vagrant, but I haven't really done anything with it.

42:26 For everybody listening, what's Vagrant?

42:28 Vagrant is basically a tool that eases the usage of virtual machines.

42:33 So you can just download an image of your virtual machine and start it up and launch your process inside.

42:46 What 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:00 For example, your desktop is Windows and you even don't have Python there at all.

43:06 You just take Vagrant virtual machine image.

43:10 And in PyCharm, you add Python located in this virtual machine as a remote interpreter.

43:14 And after that, yeah, you have all the features of the IDE.

43:20 You can run your code, debug, run your test profile, and you have code completion.

43:26 So everything.

43:27 That's really cool.

43:28 So say I'm on Windows and I don't have Python set up.

43:32 I could have a Vagrant virtual machine running Ubuntu with Python 3 installed.

43:37 And 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:47 Yeah, exactly.

43:47 Exactly.

43:48 That's really cool.

43:49 So you also announced Docker support.

43:52 And in my mind, Docker is like a slightly more lightweight, modern take on that same idea.

43:59 Can you maybe talk about what you're doing with Docker?

44:01 Yeah, true.

44:03 It could be seen as the same idea, but people say about it that Docker is virtualization without actual virtualization.

44:15 So Docker is the technology of containers.

44:20 So it relies on Linux core functionality to isolate processes from each other.

44:30 There is a concept of Docker image.

44:32 It's some set of configured software and files.

44:39 And when you run this image, you get a container.

44:44 So a container is a running Docker image.

44:48 And if you have several containers, they can run on the same Linux machine, but they don't interfere at all.

44:54 Every container has its own file system layer and its own network configuration.

45:05 So they don't interfere.

45:07 And after this container finishes its work, it's killed and removed.

45:14 And you don't need to dispose of nothing.

45:18 Yeah, I think Docker is really cool.

45:20 And I think it's going to make a big...

45:22 Yeah, sorry.

45:23 So sorry.

45:23 I forgot to say that the main advantage of Docker is speed.

45:29 If you, of course, for the same purpose, you can use a virtual machine, for example, Vagrant with VirtualBox.

45:35 But to start a virtual machine, it can take minutes sometimes.

45:39 And starting a Docker container is just a second or a millisecond.

45:45 So it could be really fast.

45:46 And I think that's the main selling point.

45:49 What we do in PyCharm is we have pretty much the same integration with Docker as with Vagrant.

45:58 It's different under the hood, but it looks like the same.

46:02 So you just add an interpreter inside your Docker image as a remote interpreter.

46:11 And then you just run it or debug it or profile it.

46:16 And PyCharm executes your container and takes all the necessary information attached to the process if you want to debug it and so on.

46:24 That's cool.

46:25 So what do I need to do to get started with Docker and PyCharm?

46:28 Like, do I need to go and install Docker on my machine?

46:34 Can I do this on OS X?

46:36 Does it have to be done on Linux?

46:38 What's the story there?

46:39 You can do that on Windows and macOS X and Linux.

46:44 All you need is to install so-called Docker toolbox.

46:48 That is a set of software from Docker.

46:51 It will install a Docker machine on your desktop.

46:54 And that's pretty much it.

46:57 You 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:07 And then you select Python.

47:10 For example, Python 3 Docker image and press OK.

47:14 So, and that's it.

47:15 You can execute your project just with this image inside the container.

47:22 Okay, that's really cool.

47:23 I'm going to have to play with that because that's something I've never looked into, but that sounds pretty awesome.

47:28 So one of the things that I think is cool that PyCharm has is there's a bunch of community plugins.

47:36 Like if I want to do like Markdown in PyCharm, there's probably a plugin I can get so that I can edit Markdown.

47:44 Is that correct?

47:45 Yeah, true.

47:46 There are a lot of plugins and third-party plugins and JetBrains plugins in our plugin repository.

47:52 Yeah, that's one of the things I like.

47:55 And 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:06 Do you know that?

48:07 Yeah, this one is nice.

48:08 Yeah, it's nice.

48:09 So 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:24 Or 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:37 And so when you're learning, like you can use the menus and the buttons and stuff.

48:42 But 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:48 I think it helped me a lot become more proficient.

48:51 But I think it's also helpful if you're doing a training class and you hit some keystroke and something funky happens, right?

48:57 Like, well, the students will ask, like, how did you make that happen?

49:00 And, you know, with that thing turned on, they'll see it.

49:02 So, yeah, that's really cool.

49:03 Yeah, true.

49:05 So you said there's other editors in there.

49:07 What is built in?

49:09 Like, so I can obviously edit Python.

49:11 You said HTML, JavaScript.

49:12 Does it have support for things like Angular or TypeScript or things like that?

49:17 Yeah, we do support AngularJS and TypeScript.

49:23 And much, much more.

49:25 There is a support for many different JavaScript frameworks.

49:31 Yeah, cool.

49:32 So TypeScript's interesting.

49:33 Do you just support, like, the editing of it?

49:36 Or do you have some, like, compile step that'll transpile that into JavaScript so I can actually use it?

49:42 Or do I have to do that outside of PyCharm?

49:43 I'm actually not sure about how this works in detail because I never used TypeScript support myself and never developed it.

49:52 But for sure you can compile TypeScript.

49:56 But for sure you can compile TypeScript to JavaScript from PyCharm and WebStorm.

49:59 This functionality comes into PyCharm from WebStorm.

50:03 That's right.

50:04 Okay, I see.

50:05 That's part of the integration between all the different IDE teams.

50:09 Yeah, true.

50:09 Yeah, cool.

50:10 So 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:22 Is this, you know, obviously of support for Git and subversion and so on.

50:26 But this thing you call local history.

50:28 Do you want to tell people about local history?

50:29 Yeah, local history is a cool feature.

50:32 It saved me several times from losing a portion of my work.

50:38 It is useful not very often, but when it is, it can save you a ton of time.

50:44 What is it basically, it's a versioning of your local changes that even when they are not committed.

50:51 For 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:05 Or even if you don't have version, like, if you're one of those people like, version control, don't need that, right?

51:10 Just start editing, right?

51:12 I hope that there is not much of those people.

51:16 But 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:30 So you just open local history and you see all changes that happened with your files.

51:38 And this is a very detailed view.

51:40 It shows differences between files.

51:42 And yeah.

51:43 Yeah, 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:52 So 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:01 Yeah, that's really helpful.

52:03 Like you said, I probably use that once every two months.

52:05 But when I do, I'm like, oh, thank goodness.

52:06 Yeah, yeah, yeah.

52:07 Maybe even less, but I still really appreciate it when it works.

52:13 We're kind of getting towards the end of the show a little bit.

52:15 And one of the things I think is probably more interesting than just the details.

52:20 I 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:28 I wanted to talk about these so that people out there are like, there's this tool that can help so much.

52:34 Even 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:42 You get this great thing to help you write code and work on, especially large projects.

52:47 You 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:58 So 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:05 I don't really need an IDE.

53:07 I work on these big Python projects, but I've never needed an IDE.

53:11 I just feel like they're in my way.

53:13 Like, what would you say, give PyCharm a chance or think about some kind of IDE that's there to sort of support them?

53:19 First of all, I just offer a person to try, but if he has already tried.

53:26 And for some reason find that he feels more at home with Vim.

53:33 So I don't know.

53:35 It's also okay.

53:37 I think that everybody choose their own way to develop applications.

53:44 I think the right approach is to try different things.

53:48 So it's not very effective when you're stuck with something and you don't try different things.

53:55 I think even with somebody, programs uses PyCharm extensively.

54:02 I think it's okay also to try different editors.

54:05 You can find different approaches and you can compare.

54:09 So it's just better to try.

54:12 So that's my philosophy.

54:14 As I said before, I've done that with different languages.

54:17 So when I wanted to pick up dynamic language, I just tried different things.

54:22 So I think the same thing applies to IDs and editors.

54:28 If 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:36 If they're kind of like, you know, IDs are not for me, right?

54:40 If I told you, hey, this thing has local history, they're like, yeah, I use Git.

54:44 No problem.

54:45 Oh, this thing has code coverage.

54:47 Well, I can use, you know, coverage.py and get that.

54:51 And I think it's the bringing it all together.

54:55 Like all, no single feature is like, they're great, but they're not that amazing.

54:59 But, 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:08 So that's kind of my view of the benefits is no single feature is going to really make it worthwhile.

55:16 But taken as a whole, they start to really add up.

55:18 Yeah, true.

55:20 I agree with you.

55:21 That's true.

55:22 There's always a couple of questions I ask my guests before we sort of wrap up the show.

55:29 What'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:38 Actually, my favorite is coverage.py.

55:43 I like it very much and I contributed to it at some moment unintentionally.

55:51 But it's very well-known package, actually.

55:56 If to point something to people, I would notice TOX.

56:01 I think that's very, very useful when you want to test your Python projects on different environments, in different Pythons, for example.

56:10 And yeah, I've heard about such a project called DTOX, which is basically TOX, but executes your TOX tests in parallel.

56:21 I never tried it, but I think the idea is cool, so maybe it's worth trying.

56:26 Yeah, that's pretty awesome.

56:28 So, coverage PY, TOX, T-O-X?

56:32 Yes.

56:32 And then DTOX.

56:33 Yeah, okay.

56:34 Very nice.

56:35 Well, thanks for recommendations.

56:36 And then, I think you might be biased on this one, but I always ask everyone what their favorite editor is.

56:41 Are you an Emacs person, a PyCharm person, a Vim, Sublime Text?

56:45 Yeah, it is.

56:46 It is PyCharm, of course.

56:48 Of course.

56:49 All right.

56:49 That's awesome.

56:50 So, before we go, do you have any, like, calls to actions, things you'd like people to do, know about?

56:57 Try PyCharm if you did not yet, if you haven't.

57:03 And please say us what you think.

57:06 So, we do listen to our users.

57:09 And the things that our users tell us are very important.

57:16 Okay.

57:17 Yeah, that's cool.

57:18 If we have feedback for you, how do we give it to you?

57:21 There are different channels.

57:23 You can submit issues and feature requests to our tracker.

57:26 Or you can write our support.

57:29 There is a forum.

57:32 I 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:41 And actually, we do look at votes when we consider features for the next version to be included in the roadmap.

57:53 Okay.

57:54 Excellent.

57:54 Well, it's been really fun to talk to you about PyCharm.

57:57 It's quite a project you guys put together there.

57:59 Thank you.

58:01 It was a pleasure to talk with you.

58:02 Yeah.

58:03 Thanks for being on the show.

58:03 See you later.

58:05 This has been another episode of Talk Python to Me.

58:08 Today's guest was Dmitry Trofimov.

58:10 And this episode has been sponsored by Hired and OpBeat.

58:12 Thank you guys for supporting the show.

58:15 Hired wants to help you find your next big thing.

58:17 Visit Hired.com slash Talk Python to Me to get five or more offers with salary and equity presented right up front.

58:24 And a special listener signing bonus of $4,000.

58:26 OpBeat is mission control for your Python web applications.

58:31 Keep an eye on errors, performance, profiling, and more for your Django and Flask web app.

58:36 Tell them thanks for supporting the show on Twitter where they are at OpBeat.

58:40 Did you know you can personally support the show too?

58:42 Just visit Patreon.com slash mkennedy and join over 60 listeners who contribute between $1 and $2 per episode.

58:50 You can find the links from the show at talkpython.fm/episodes slash show slash 36.

58:56 And be sure to subscribe to the show.

58:58 Open your favorite podcatcher and search for Python.

59:01 We should be right at the top.

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

59:06 Our theme music is Developers, Developers, Developers by Corey Smith who goes by Smix.

59:11 You can hear the entire song on talkpython.fm.

59:14 This is your host, Michael Kennedy.

59:16 Thanks again for listening.

59:18 Smix takes it out of here.

59:20 Stating with my voice.

59:22 There's no norm that I can feel within.

59:24 Haven't been sleeping.

59:25 I've been using lots of rest.

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

59:29 I'll pass the mic back to who rocked it best.

59:34 I'll pass the mic back to who rocked it best.

59:36 I'll pass the mic back to who rocked it best.

59:38 I'll pass the mic back to who rocked it best.

59:39 I'll pass the mic back to who rocked it best.

59:41 I'll pass the mic back to who rocked it best.

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