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? If your answer is Microsoft Outlook, my heart goes out to you, stay strong. But for most of us, it's probably a toss up between our web browser and code editors. And for editors, there is basically two camps- there is the light weight smart text editors such as Vim, Emacs and Sublime Text, and heavy weight but highly functional IDEs such as PyDev and PyCharm. This week, you'll meet Dmitry Trofimov who is one of the main developers behind one of my favorite editors PyCharm.

00:00 This is episode #36 of Talk Python To Me. Recorded November 11th, 2015.

00:00 [music]

01:03 Welcome to Talk Python To Me, a weekly podcast on Python, the language, the libraries, the ecosystem and the personalities. This is your host, Michael Kennedy, follow me on Twitter where I am at @mkennedy, keep up with the show and listen to past episodes at talkpython.fm, and follow the show on Twitter via @talkpython.

01:03 This episode is brought to you by Hired and Opbeat. Thank them for supporting the show on Twitter via @hired_hq and @opbeat.

01:31 Hi everyone. Thanks for listening to this episode. I have a few quick comments before we get to the interview. Some of the features we talk about are better understood visually rather than described in audio. And for that reason and others I decided to write a blog post visually highlighting some of these concepts. This post is called "9 Reasons You Should Be Using PyCharm". If you are interested, check it out at bit.ly/whypycharm.

01:55 Last but not least. The PyCharm team at JetBrains offered to give away 3 annual subscriptions to PyCharm professional. I'll do the drawing Monday, December 7th, that's a week from the release data of this podcast, all you have to do to be eligible is become a friend of the show; visit talkpython.fm and click 'friends of the show' in the navigation bar and sign up. Now, let's get onto the show.

02:15 Let me introduce Dmitry. Dmitry Trofimov currently leads the development of PyCharm, a popular Python IDE by JetBrains. Dmitry is passionate about automation and software tooling. Before PyCharm he implemented many different tools for a variety of companies including a visual site scraper generator a model to code mapper sand even a generator for hardware used in submarines. In his spare time, he is a committed running enthusiast and triathlete. Dmitry lives in Munich Germany.

02:46 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 with you today, it's going to be great.

02:57 Yes, sure, thanks for inviting me.

03:01 Yeah. So, before we dig into all that, let's start at the beginning- how did you get into programming in Python, what's your story?

03:07 That was long ago actually. My first programming experience was when I was about 7 years old, back then I had a ZX Spectrum computer and it was possible to program, it was Sinclair basic. So I read a book about programming basics and found some source program inside of the book and this program supposed to do something cool, so I set down and typed all the program into the computer.

03:39 Actually it was without full understanding how does it work. I was 7 and I took like an hour or something to type that program in, and after I finished I felt relief, but then, when I tried to run it it just failed. So, it didn't start. And I had no clue why and the error message was totally unclear for me and it was very frustrating and nobody could help me because I was at home alone, and I felt like I was betrayed by the book which I trusted. So, yeah, maybe if I started to learn programming today with Python and PyCharm for example, I would have much more pleasant experience, at least Python is much better language.

04:24 And PyCharm would hint me about which error I had and which is more important, where it was. So yeah, maybe. But my programming story didn't end there obviously. Several years after I went into computer class where I learned how to program Pascal. There was a brilliant teacher and Turbo Pascal IDE and I learned step by step and at some point I realized that I can do computer programming in Pascal. Maybe that's why I'm a fan of IDEs because of Turbo Pascal, I don't know.

05:01 Young, impressionable, programmer.

05:03 Yeah.

05:05 Awesome, so how did you go from Pascal to Python?

05:08 Actually, from Pascal I converted to Java directly, so it was C and Assembler in the middle somewhere, and then I've been doing a lot of Java and at some point I realized that I need to have scripting language in my toolbox but I couldn't choose which one. And I wrote one small project, in several languages just to be able to compare them; I took Groovy, Ruby, Python and Perl. Perl was a total disaster, but others were more or less equal. But I remember my impression from Python that felt pretty much like all other languages but at the same time, very different from them and everything felt reasonable and easy, and I liked that. So, since that I used Python from time to time, and then I joined JetBrains to make a new IDE for Python called PyCharm. It was in beta so I 'm working on it until now, it was five and a half years ago.

06:25 That's really excellent. And I've never heard people choosing the language the way just described it, but it's such a good idea to say, look, I'm interested in learning this type of language, and it looks like there is these choices 4, 5 or 6 or whatever and the idea of writing a simple program in each and then comparing the experience that's really cool, I think more people should adopt that.

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

06:56 Yeah, I always kind of just go on with do the research see what's popular, what are the capabilities, what are the pluses and minuses, and then I'll just dive into one and just try to learn it. I never did set down and like do a bunch together, compare and contrast, that's cool. PyCharm, before we get to PyCharm maybe, when I think about the company that makes the PyCharm, JetBrains, where you work, I see you guys as one of the premiere if not the premiere developer tool companies out there. Can you maybe just talk a little bit about what is JetBrains, what type of apps and products you build?

07:37 Yeah, sure. JetBrains is a company that makes tools for software developers as you said, and currently there are more than 500 people working there, and we have offices in Saint-Petersburg, Munich, Prague and Boston. So the two biggest development spots are in Saint-Petersburg and Munich. And yeah, we make tools for software developers and actually being ourselves software developers this allows us to make really good tools. There is a culture in JetBrains that everybody write code even ourselves, we do program a lot actually.

08:23 So, the company grows but this is amazing that this culture stays. And talking about our products, of course we have many IDEs like PyCharm and the Intellij Idea, RubyMine, PhPStorm, WebStorm, CLion, AppCode. So basically for most major and popular languages. If there is no IDE for a language there should be a plugin that is maintained by JetBrains or third parties. The IntelliJ platform is quite diverse and solid.

09:04 Yeah, that seems to be kind of the foundation of most of your IDEs. I kind of see you guys as the company that looks at what other software development systems are doing or built at, and fixing the problems. Like, Microsoft makes Visual Studio and it's not bad, but it has these issues and so you guys make ReSharper.

09:25 Yeah, exactly.

09:27 And then, Apple makes X code but you are like, 'oh this is not so great, we can make this thing called AppCode and kind of do it better'. So, I really think that's cool, and Python- there is not really a company that makes an official tools chain for Python because it's obviously so organic and open source, but you kind of did that for the ecosystem with PyCharm, right? I talk about PyCharm a lot in the show and I wanted to have you guys on here because I really think the tools that you make for Python make a significant difference for people working in Python, if they are willing and have the time and energy and interest to actually learn the tools.

10:14 Tools are very important. I wanted also to add that many people know about our IDEs. But less people know that also we create other tools for software developers, so we have a range of several site tools, like it is continuous integration called TeamCity, there is a bugtracker called YouTrack, and there is a code review tool called UpSource and we even make our own JVM programming language called Kotlin. So every area of software development, we try to make a product in this area and even to actually be used this product and this allows us to make it good.

10:56 Yeah, if you don't use the thing you are building then you just- it's just not good. You have to use the thing you are building to make it truly excellent.

11:06 Sure. Sure.

11:06 All right, so like I said, I think most people know PyCharm but maybe give us the 30 second elevator pitch. What is it?

11:14 PyCharm is an IDE for Python. There are 2 editions of PyCharm. The first is PyCharm community edition, that is free and open source and it provides all basic functionality without any limitations. And there is a professional edition, it's not free but it has many features especially for professional developers like support for web technology, many languages like HTML, Css, Javascript, different Javascript frameworks, Python web frameworks like Django, Flask, Pyramid, Web2Py, and lot of functionality like working with databases and working with code to a remote environment, and profiling, code cover, this is all in professional edition.

12:04 Yeah, 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, so I'm interested to ask you about it. One of the things that is cool about PyCharm I think is that it's really cross platform.

12:20 Yeah, that's true. PyCharm as well as IntelliJ platform is implemented in Java so it basically runs everywhere where JVM can run. There are some parts that are native but they are not essential for the main functionality actually. And there are 3 operational systems that are officially supported, there is macOS X, Linux and Windows but actually I know that our users even manage to run PyCharm on some environments like RaspberryPi, and it's funny because we have issues in our tracker that sound like it's great that I could run PyCharm on RaspberryPi, but unfortunately the embedded terminal is not working. So, yeah, in that cases we just answer, 'ok sorry for that, but embedded terminal is also open source so you can port it to RaspberryPi...' Something like that.

13:25 Yeah, that's really great. The fact that it runs on RaspberryPi is pretty awesome, people are saying, oh this part doesn't work, it's like, did you really expect it all to work? Yeah that's cool, I've seen somewhere, I think I've even seen it on Twitter not too long ago, that somebody had it running inside of a Docker container.

13:46 Yeah, that's crazy. It's just crazy. We've just added support for Docker in the latest version, so it was also a response like 'oh that's great but what I want is to run PyCharm in Docker and then run containers from PyCharm'.

14:05 Yeah, it was very nice.

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

14:13 Yeah, why it's probably just because you can, right, but when you guys announce support for Docker that's like you can create Docker containers that run your apps you can run PyCharm within Docker containers but I guess someone got that working which is cool.

14:29 Yeah.

14:31 So you said there is like 500 people at JetBrains. How many people are actually part of the PyCharm initiative?

14:38 There are 14 people working directly on PyCharm, PyCharm is built upon IntelliJ platform so if we count those people, so it adds like from 50-60 people more that are contributing directly to platform but actually that is not very easy to count because there are a lot of people who work on different IDEs for example WebStorm, all functionality of WebStorm comes with PyCharm professional edition. So do we count as IntelliJ platform or not, that's difficult to measure.

15:19 Yeah, there is a lot of intersecting between the different IDE teams like AppCode and WebStorm and so, I can see that that's tricky. Ok, so it's a pretty large team full time team working on PyCharm, yeah?

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

15:46 That is really excellent, cheers to you guys, that's great. So when I run PyCharm, it said it's built on IntelliJ, like how much of the thing that is running, that I am working with, is PyCharm and how much of that is just IntelliJ with like a little understanding layer back in the Python?

16:04 Actually all the IntelliJ platform is built that way that it is language agnostic. So it's like a framework upon which you can write parser and inspections, but there is actually no that strict separation, so...

16:25 When you are getting started, there is different ways to get started in Python. One way is to just type Python in your terminal or command prompt, and then start entering stuff into the repl, that's probably the least productive thing you can do, although it's the easiest to get started, right, you can create variables and import modules and things like that. And then as you go up you know, there is stuff like editors like Vim and Emacs, and Sublime text, where they are really nice editors, but they don't necessarily help you understand the standard library and things like that, necessarily. And then, you've got PyCharm which can help you the language- where do you think people should start, what are your thoughts? Is there a lot of value in starting sort of with no support 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:28 I think that the supportive environment has been efficient actually, it even can help you run the language, and it assists you, so I would prefer to start with an IDE.

17:46 You know, we are both sort of self selected in that sense as well, but I kind of agree with you that it's great to memorize the API for things like requests or the string library but 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, as a new person.

18:13 Yeah sure, and you do memorize them actually, because it just takes less time when you see it in code completion not in Google for example or in documentation. So you get information faster and you do memorize it.

18:30 There is some cool plug-ins that I want to come back to later to talk about that as well, but another thing that's really challenging can be creating new types of projects. So if I want a new Flask website based on bootstrap, or I want a Pyramid website based on the started template or something like that; can you talk about like sort of what the types of projects that you can create in PyCharm as like starter projects?

19:00 Yes sure. It's mostly all types of Python web framework so it is Django, Flask, Pyramid, Web2Py and also all kinds of pure web projects, actually the main projects that you can create in PyCharm is pure Python projects, you can just start with that for example and then you can add everything that you want. If you know that you are going to develop Django project than it's better to start with Django project from the start because everything will be configured and you will have template.

19:36 Yeah, I think one of the things that people struggle with, and as you get experience you forget that it's actually really hard, you are like 'oh that's a little bit of extra work', but in the beginning that can be really hard so suppose I want to get started with Pyramid, well, to get started with Pyramid, I can't just create a file and start typing you know, create my wsgi app and here is my handler configurations and so on, I have to pip install Pyramid, and the various dependencies, and then I've got to know to use like p create the thing that will generate the template starter code or of course write it from scratch which is a lot of work, and that will generate a whole bunch of stuff, whole project structure and then I've got to run you know, the setup configuration stuff because it's all treated like packages and so on. And I think people that are experienced with Python sort of forget how non obvious that part is right, but having it just as a thing you click, 'I'd like a new Pyramid app' and all that stuff happen. That's really cool, and I think that's one of the things that's nice about creating new projects with PyCharm is a lot of that configuration stuff and dependency stuff is handled all in one shot.

19:36 [music]

19:36 This episode is brought to you by Hired. Hired is a two-sided, curated marketplace that connects the world's knowledge workers to the best opportunities.

19:36 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. Typically, candidates receive 5 or more offers in just the first week and there are no obligations, ever.

19:36 Sounds pretty awesome, doesn't it? Well did I mention the signing bonus? Everyone who accepts a job from Hired gets a $2,000 signing bonus. And, as Talk Python listeners, it get's way sweeter! Use the link hired.com/talkpythontome and Hired will double the signing bonus to $4,000!

19:36 Opportunity is knocking, visit hired.com/talkpythontome and answer the call.

19:36 [music]

22:06 True, but also you can start you are going step by step with PyCharm, so you can just create pure Python project or you can just open a directory and create file there and then start typing something and when you have a usage of Pyramid PyCharm will offer you to install this package from PyPi so you can do that and it's not that strict, if you develop in Pyramid you need to start from Pyramid project and generate everything.

22:40 Right, that's true. So, it's possible that it's helpful for you but if you already have like a Pyramid website you can just grab the directory, they are on PyCharm then it'll sort of be as if you had created it right?

22:52 Yeah, PyCharm will understand the structure of your project that is actually Pyramid and it will configure pretty much of everything.

23:01 I don't really want to necessarily go through all the features of PyCharm, but maybe we could talk about a couple of favorites, like for example I think my two favorite features in PyCharm are the sort of smart intellisense 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, so that sort of intellisence is really cool. And then, the sort of navigation stuff, right, so I can say here is the function being called on some objects take me to its implementation. What are your favorites?

23:41 Actually I also like intellisence and navigation but my favorite is definitely the debugger. I don't know, maybe since those days when I wrote Pascal and Turbo Pascal IDE I always liked the ability to dive and run in program and see what is actually happening there. So I am proud that PyCharm has a very solid debugger and we have some almost unique features like debugging of subprocesses, and debugging of applications on remote environments. I like this part most. Actually, we have quite good version control support, JIT support for example. So, it's not bad. I would even say amazing but it could be considered to be modest from JetBrains person but yes I like our integration and my favorite feature in there is ability to compare different branches and JIT lock.

24:40 Ok, yeah, that's pretty awesome.

24:41 Local history I'm sorry, local history is amazing also.

24:45 Yeah. I was definitely going to say if you are talking about version control, this idea of local history is cool. Let's take a step back for a minute and dig into the other ones just for a moment and then I want to talk about local history because that's really awesome. So, how do you guys do intellisense for Python, like how does that work in a dynamic language?

25:08 How does it work? Intellisense in PyCharm works that way that when you write your code in PyCharm, it is parsed in real time. And analyzed this way, that PyCharm tries to understand what is your goal and how to help you the best way. So it offers you code completion, it reformats your code and sorts correct intendation, for example so it highlights of course it highlights syntax errors, but beyond that, it also tries to warn you about some errors that are not so obvious for example you reuse variable that you iterate through in the cycle or if it could be undefined how is it implemented...

26:05 Well, more what I am thinking is when I write Python code, I don't ever declare a type, I don't say int x=7 I just say x=7. And sometimes it's really obvious right, when you declare just like that, but sometimes you know, there is a long chain of events that leads to data being passed from one stage to another to another to finally been assigned to a variable and it seems like you guys are doing really good job of actually knowing what that suppose to be.

26:33 Yeah, we try to types for variables and we do it quite good so it's called data flow analyses so when you write your code inside function or methods we trace the types of all the variables.

26:56 Yeah, I think that's really awesome, 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 it will all sort of then suggest latter as intellisence but it doesn't really understand like the way the whole program fits together. It's missing a lot of the cool stuff that you guys have there. I know you just announced support for Python 3.5. and that includes this thing called Python type hints.

27:28 Yeah, actually PyCharm team participated, it was involved actually in the process of elaboration of this proposal, so-

27:39 That's really cool, could you maybe before I ask you a question about it, maybe you could tell everyone what those are?

27:46 There is PEP484 so called this is initiative add in declaration of type in into Python so before there was no standard way to annotate type, so it was something starting from Python 3 but it was very limited and could not be used extensive. In Python 3.5 Guido van Rossum came up with the proposal of elaboration of standard notation for annotation types for arguments and variables.

28:28 Yeah, so maybe an example would be, I've got a function, say hello. Maybe the function is called 'Say Hello' and you give it a name and a time of day. How would I use type hints to maybe indicate that the name is always suppose to be some kind of string, and the time of day is an integer, something like this?

28:48 For a date you write semi colon and then a data type and to annotate the return value you write error so it's minus greater and you write a return type and actually the main thing here is that those types do not influence the run time. So they are only for tools like PyCharm and for checkers for different linters to validate your code to find errors.

29:27 Right, of course. Yeah, so the type doesn't really change anything about how Python works, as a language or an execution environment, but the reason I think they are interesting is for people like you and other refactoring tools and like you said linters, what do you guys thing about type hints in Python, are you fan of it?

29:48 Actually, I see it a bit controversial because in some sense it kills the spirit of Python. But I would not prefer that all the Python sources become full of type annotations because it would be not Python, it would be something different. But still, that is obvious that there is a need to annotate standard libraries. And in this PEP484 proposal, there is a way to annotate types not in your source but in separate like head or files and I think that would be beneficial, if every developer of popular library would other than writing code, would make this type annotations for users of his library because it will leverage the usage because people would be able to use tools with code completion and it would much easier for them to learn the library so I think this is the way to go but it should be taken with care.

31:02 Ok, I think that's a really good recommendation, maybe when I go to write code if I am just writing app for myself maybe I don't bother to do any of these type hints but maybe the libraries that I am consuming, especially the standard library, if it had that annotations, than that makes it much easier for me to kind of know what to do, for linters to say oh it looks like your passing a double it expects an integer or something like this, right.

31:31 Yeah, the greatest accomplishment of PEP484 and Python 3.5 in the long run there is a standard annotation. So, it's fixed now and it's quite advanced to express pretty much everything about types.

31:49 Yeah, I think you are right, this is and is going to be controversial feature of the language but it's going to be interesting to see what happens over time, you know.

32:03 Yeah. Because before, why is important to have this standard notation, in PyCharm we had our own notation actually, because we are dealing with type inference, we had to annotate some parts of standard library on different libraries that could not be infered so we had to annotate them and we came up with our own annotation and it was not very good to invent your own will.

32:35 So the PyCharm team actually has before the type hints came along you had done something else that is kind of like type hints for the standard library, just so that the PyCharm could work correctly, is this true?

32:49 Yeas, this is true. we had to do that to be able to annotate standard library to provide type inference in PyCharm and as far as I know Google had their own annotation and set of type annotations so now it's great that we can merge our efforts, create a common repository of type annotations like there is one for type script as far as I know. I think that that's moving in the right direction.

33:24 Yeah, that's definitely moving in the right direction. Ok, yeah it's going to be interesting to see what happens with this whole type hints thing because in my mind, it's really for people like you that are building tools to help us and maybe when we are writing code, maybe type hints are just the thing that make our life a little bit better because our tools are better. In PyCharm you can run both, Python 2 and Python 3. You also have really good support for virtual environments, things like that, right, you can actually withing the tool say I'm going to create a new project and as part of creating this project set up a virtual environment based on either Python 2 or Python 3 or whatever. What other implementations do you guys support, like do you support PyPy?

34:07 Sure, yeah, we do support PyPy and we support Jython and IronPython.

34:13 Interesting. I didn't realize you supported IronPython, I guess that would be a Windows only feature, wouldn't it?

34:18 Yeah. True.

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

34:22 [music]

34:22 This episode is brought to you by Opbeat. Opbeat is application monitoring for developers, it's performance monitoring, error log in, release tracking and workflow in one simple product. Opbeat is integrated with your codebase and makes monitoring and debugging of your production apps much faster and your code better. Opbeat is free for an unlimited number of users and starting today, Opbeat is announcing that their Flask support is graduating from Beta to a full commercial product. Visit Opbeat.com/Flask, to get started today.

34:22 [music]

35:18 So another thing that I think is cool is I can go to my project and go to my project settings in PyCharm and it will show me regardless whether I am using like a system level Python or I am using like in virtual environment that was created, it will show me all the packages that have been installed from pip and their versions and whether there are upgrades that I could potentially install, things like that, right?

35:42 Yeah, true, that's right.

35:45 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 and you can say find me my package and then click to install it and it will kind of automate a lot of that stuff for you.

35:58 Yeah, and you even can install it from your editor if you have an import you can just press alt enter for example and PyCharm will install this package to your active Python.

36:13 Yeah, 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, so when you see problems in code, or pep8 violations, or maybe an import of a package that lives on PyPi but is not actually installed into the environment that you have active, PyCharm will suggest fixes, right?

36:40 Right, and in most cases you just press Alt Enter and PyCharm will fix it for you.

36:46 Yeah. So, like for example if I say ‘import request’ and then I start typing things and I don't actually have say I'm in a virtual environment I don't have Request installed in there, it would say, 'hey here is a package you are importing and we know about it, we know it lives on PyPi but you don't have it installed, hit Alt Enter and we'll just install it for you'

37:04 Yeas, that's true.

37:07 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. Very cool.

37:14 Yeah.

37:15 Yeah, I just think constant watching of 'hey, how can I help you' right a lot of times as programmers we are dealing with lots of details, and putting pieces together just so like I've got to make sure I've got this package and its dependencies installed, and I've got to have this import keyword appear just so and I think a lot of the mental juggling that we have to do can go away if you have some kind of editor that says 'oh, we've noticed that you didn't connect this piece here, hit Alt Enter and it's connected', you know, like we may have pip installed some library but you didn't type import at the top for example.

37:53 Yeah. That's sort of handy. I cannot even imagine how to program without it when you get used to it it's difficult.

38:05 It totally is difficult and you know, I do a ton of Python programming of course and the other work that I do is typically in CSharp and Visual Studio and I have exactly the same feeling when I'm over there like if I don't have ReSharper I'm calling this thing partly broken. How can I continue to work in this area, this is barbaric if I have to go to the top of the file and type import or use or whatever, depending on the language. Yeah, that's awesome. So, one of the things that's super important in dynamic languages like Python is since there is no real compile step, there can be errors that are just not detected, right, maybe even something as simple as a compiler would have detected it, but because it's not ever compiled which is working not really well for Python, but it means those errors do not get caught so typically having some other way to catch them like unit testing is really good.

39:00 Sure, unit testing is—

39:03 Do you guys have built in support for Unit testing and like code coverage and stuff like that?

39:06 Yeah, sure. Unit testing I think is basic thing when you are dealing with a dynamic language, and yes of course PyCharm has support for Unit testing and support for different test runners, not only Unit test but Nose test, Py Test, AT test. What you can do is you can run your tests from PyCharm and you will see the results in a nice formatted tree, and you can navigate directly to source, to C stack trace and of course you can debug your tests, you can profile them you can see coverage results almost everything possible what you can imagine.

39:50 So profiling is interesting. In show #28, we did a show about profiling Python sort of from the command line. And about that same time, I saw that you guys actually announced profiling support for PyCharm. And that's pretty excellent, I have not had a chance to try it yet, how does that work, can you walk me through what like I would learn if I do profiling and do I do it in PyCharm?

40:14 That's actually pretty simple to use, you just press profile button for your own configuration and your process is executed with CProfile injected and as long as you want to capture a snapshot with your profile data you just press a button capture snapshot and it's shown in PyCharm with statistics of what method-- statistic for all functions how long did it take for them to launch and actually we have a nice visual representation in graph form where the hot spots are colored red and you can just see what is slow in your program.

41:05 Yeah, the whole visual component of it I think it's really cool.

41:09 Yeah and unfortunately just after we made the first attempt of making the integration with CProfile it appeared that it's too limited and too basic to add features and it was like a pity that there were no really good profiling backend for Python, because CProfile doesn't provide you a lot of information. But hopefully, this summer PyPy team has announced VM for profiler that seems to be much better and more advanced as CProfile and we plan to integrate this one in PyCharm as long as it will support Mac Os X and Windows but they have plans to do that and we will collaborate together to make this happen.

42:13 Oh yeah, that's going to be really excellent, because it's already helpful and that will be even better, very nice. So another thing that you guys have support for is Vagrant. And, I know of Vagrant but I haven't really done anything with it. What's for everybody listening, what's Vagrant?

42:28 Vagrant is basically a tool that eases the usage of virtual machines. So you can just download image of your virtual machine and start up and launch your process inside. 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. For example, your desktop is Windows and you even don't have Python there at all, you just take Vagrant virtual machine image and in PyCharm you add Python located in this virtual machine as a remote interpreter. And after that, yeah you have all the features of the IDE you can run your code, debug, run your test profile and you have code completions so everything—

43:28 That's really cool, so like say I'm on Windows and I don't have Python setup, I could have a Vagrant virtual machine running Ubuntu with Python 3 installed 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:49 That's really cool. So, you also announced Docker support. In my mind, like Docker it's like slightly more light weight modern take on that same idea. Can you maybe talk about what you are doing with Docker.

44:02 Yeah, true. It could be seen as the same idea but it's people say about it that Docker is virtualisation without actual virtualisation, so Docker is the technologer of containers, so it relies on Linux core functionality to isolate processes from each other, there is a concept of Docker image, it's some set of configured software and files and when you run this image you get a container , so a container is running Docker image and if you have several containers they can run on the same Linux machine but they don't interfere at all. Every container has its own file system layer and it's on network configuration so they don't interfere and after this container finishes its work it's killed and removed and you don't need to dispose nothing.

45:18 Yeah, I think Docker is really cool and I think it's going to make a big-

45:23 Yeah, sorry I forgot to say, the main advantage of Docker is speed, of course for the same purpose you can use virtual machine for example, Vagrant with virtual box but to start virtual machine it can take minutes sometimes, and starting Docker container is just a second or a milisecond so it could be really fast. And I think that's a main selling point and what we do in PyCharm is we have pretty much the same integration with Dockers as with Vagrant, it's different under the hood but it looks like the same so you just add interpreter inside your Docker image as remote interpreter and then you just run it or debug it or profile it 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:25 That's cool, so what do I need to do to get started with Docker and PyCharm, like do I need to go and install Docker on my machine, can I do this at OS10, does it have to be done on Linux, what's the story there?

46:41 You can do that on Windows and macOSX and Linux all you need is to install so called Docker toolbox that is a set of software from Docker it will install a Docker machine on your desktop and that's pretty much it, you just take PyCharm professional edition and you go to all settings and remote interpreter and say that it should be Docker remote interpreter and then you select Python 3 Docker image and press ok and that's it. You can execute your project just with this image inside the container.

47:23 Ok, that's really cool, I'm going to have to play with that because that's something I've never looked into but that sounds pretty awesome. So, one of the things that I think is cool that PyCharm has is there is a bunch of community plugins like if I want to do like markdown in PyCharm there is probably a plugin I can get so that I can add a markdown, is that correct?

47:45 Yeah, true, there are a lot of plugins and JetBrains plugins, and all pluging repository.

47:54 Yeah, that's one of the things I like, my favorite one, since I do a lot of training, but I also think is how 48:00 even just if you are exploring hearts of the tools that you don't know is this thing called presentation assistant. Do you know that?

48:07 Yeah, this one is nice.

48:09 Yeah, it's nice so every time you execute some kind of operation like if do a refactoring, or a navigation, or some sort of correct auto correct like pulling a missing import statement or something like that, 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 is. And so, when you are learning, like you can use the menus and the buttons and stuff, 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? I think it helped me a lot to become more proficient but I think it's also helpful you are doing a training class and you hit some keystroke and something funky happens right, like the students will ask 'how did you make that happen?' And you know with that thing turned on, I'll see it, so that's really cool.

49:05 Yeah. True.

49:06 So you say there is other editors in there, what is built in, so I can obviously edit Python, you said HTML, Javascript, does it have support for things like Angular or Typescript?

49:16 Yeah. We do support Angular JS and Typescript yeah, and much more, there is the support for many different Javascript frameworks.

49:32 Yeah, cool. So Typescript is interesting, do you just support like the editing of it or do you have some like compile step that will transpile that into Javascript so I can actually use it or do I have to do that outside of PyCharm?

49:44 I'm actually not sure about how this works in detail because I never used Typescript support myself and never developed it but for sure you can compile Typescript to Javascript from PyCharm and WebStorm, this functionality comes into PyCharm from WebStorm.

50:03 That's right, ok, I see, that's part of the integration between all the different IDE teams.

50:11 Yeah true.

50:11 Yeah, cool. So one thing you talked about earlier that I thought was pretty cool and I thought wow this is really-- several times it saved me from like messing up something bad is this obviously you have support for GIT subversion and so on but this thing you called local history. Do you want to tell people about local history?

50:30 Yeah. Local history is a cool feature. It saved me several times from losing a portion of my work. It is useful not very often but when it is, it can save you a ton of time. What is basically, it's a versioning of your local changes that even when they are not committed, for example when you have your local changes lost due to some broken external tool or some 50:59 use for example when you accidentally reset everything or—

51:06 Or even if you don't have like if you are one of those people who are like; 'versioning control- I don't need that' right, so

51:14 I hope there is not much of those people but still, yeah, if somebody doesn't use versioning control for example what PyCharm can offer is to restore or revert your changes to some point in the history so you just open local history and you see all changes that happened with your files and this is very detailed view, it shows difference in files and yeah...

51:44 Yeah, the way I think of it is kind of like git but the git that you didn't setup or think about or bothered to interact with right, so independent of whatever real source control using there is like a separate automatic auto saved type of version control that you can fall back on if you need it. That's really helpful, I use that once every two months, but when I do I'm like 'oh thank you for this.'

52:13 We are kind of getting towards the end of the show a little bit and one of the things I think is probably more interesting than just the details I wanted to talk about some of the details because we just barely touched on all the cool things that I think PyCharm can do, I wanted to talk about this so that people out there are like there is this tool that can help so much even though maybe it starts slower than Vim or Emacs or Sublime Text, you know if you are willing to wait like 2 seconds, that's not really that long, you get this great thing to help you write code and work on especially large projects.

52:47 You know, one of the things that I hear a lot obviously there is a bunch of people that like tools that help them a lot but there is also people that just want super light weight. So if somebody came to you and said Dmitry, I think what you guys built is cool but it's just not for me, I don't really need an IDE, I work on these big Python projects but I've never needed an IDE I just feel like they are in my way, like what would you say give PyCharm a chance or think of some kind of IDE that is there to sort of support them?

53:21 First of all, I just offer a person to try but if he has already tried it and for some reason found that he feels more at home with Vim, I don't know it's also Ok, I think that everybody choose their own way to do applications. I think the right approach is to try different things so it's not very effective when you are stuck with something and you don't try different things, I think even when somebody programs uses PyCharm I think it's ok also to try different editors. You can find different approaches and you can compare so it's just better to try. My philosophy is as I said before, I have done that with different languages, so when I wanted to pick up a dynamic language I just tried different things, I think that the same thing applies to IDEs and editors.

54:28 If you look at any of the individual features I don't think there is a single feature that would convince anybody, 'hey I should try this tool', if they are kind of like IDEs are not for me right. If I told you 'hey this thing has local history', they are like 'yeah, it's ok'. All this thing has code coverage- yeah I can use coverage.py and get that and I think it's the bringing it all together like all no single feature is like they are great but they are not that amazing, but 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 work in an IDE, so... that's kind of my view of the benefits as no single feature is going to really make it worthwhile but taken as a whole they start to really add up.

55:20 Yeah, true. I agree with you and that's true.

55:23 There is always a couple of questions I ask my guest before we sort of wrap up the show. What is your favorite PyPi package or maybe a project that are on GitHub or something that is cool or maybe not everyone knows about, that you would like to point out to the community?

55:39 Actually my favorite is coverage.py. I like it very much and I contribute it to it at some moment unintentionally. But it is very well known package actually. If to point something to people I would notice Tox I think that's very useful when you want to test your Python projects on different environments and different Pythons for example. And yeah, I heard about such a project called Detox, which is basically Tox but executes your Tox tests in Perl, I never tried it but I think that the idea is cool. Maybe it's worth trying.

56:27 Yeah, that's pretty awesome. So, coverage.py, Tox, and Detox. Ok, very nice, thanks for recommendations. And then, I think you might be biased on this one, but I always ask everyone what their favorite editor is. Are you an Emacs person, or a PyCharm person, or Vim, Sublime Text...?

56:46 Yeah it is PyCharm.

56:49 Of course, all right. That's awesome, so before we go, do you have any like calls to actions, things that you would like people to do, know about?

56:58 Try PyCharm if you haven't yet and please say us what you think so we do listen our users and the things that our users tell us are very important.

57:17 Ok, yeah that's cool. If we have feedback for you how do we give it to you?

57:21 There are different channels so you can submit issues and feature requests on tracker or you can write our support, there is a forum- 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 and actually we do look at votes when we consider features for the next version.

57:54 Ok, excellent. Well, it's been really fun to talk to you about PyCharm, it's quite a project you guys put together there.

58:01 Thank you, it was pleasure to talk to you.

58:02 Yeah, thanks for being on the show. See you later.

58:02 This has been another episode of Talk Python To Me.

58:02 Today's guest was Dmitry Trofimov and this episode has been sponsored by Hired and OpBeat. Thank you guys for supporting the show!

58:02 Hired wants to help you find your next big thing. Visit hired.com/talkpythontome to get 5 or more offers with salary and equity right up front and a special listener signing bonus of $4,000 USD.

58:02 Opbeat is mission control for your Python web applications. Keep an eye on errors, performance, profiling, and more in your Django and Flask web apps. Tell them thanks for supporting the show on twitter where they are @opbeat.

58:02 Did you know you can personally support the show too? Just visit patreon.com/mkennedy and join the over 60 listeners who contribute between 1-2 dollars per episode.

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

58:02 Be sure to subscribe to the show. Open your favorite podcatcher and search for Python. We should be right at the top. You can also find the iTunes and direct RSS feeds in the footer on the website.

58:02 Our theme music is Developers Developers Developers by Cory Smith, who goes by Smixx. You can hear the entire song on our website.

58:02 This is your host, Michael Kennedy. Thanks for listening!

58:02 Smixx, take us out of here.

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