Mastering PyCharm Transcripts
Chapter: Why PyCharm and IDEs?
Lecture: Why choose an IDE?
0:02 Let's expand on this idea of why an IDE
0:05 generally makes developers much more productive.
0:10 I'm going to give you 12 reasons why I think that's the case.
0:13 First of all, the entire project, all of the files and all of the different languages
0:19 are brought together in an IDE like PyCharm.
0:22 We could be working on a web application,
0:28 there might be some functions or even classes
0:30 that we're going to use in say a script block in our Chamelon templates,
0:35 and PyCharm knows about all those different things,
0:39 it can give you completion, even re-factoring help
0:42 across all these different languages, across hundreds of Python files,
0:46 across different languages, it's really great.
0:49 So this ability to understand the whole project, not just a single file,
0:53 as not just keywords, but actually as an abstract syntax tree
0:58 understanding the structure of all these different pieces of code
1:00 and putting them together,
1:03 this is super important and allows you to write small code
1:05 and navigate between them, between different files
1:08 instead of jamming everything into one huge Python file.
1:12 That leads to really high developer productivity
1:15 if you can navigate and understand code really well,
1:20 you type "something." and then boom,
1:23 here's a list of all the things that it does
1:25 even if it happens to be defined somewhere else
1:28 or somewhere not entirely clear where it comes from
1:30 that is super helpful, so you'll see the IDE really helps you write faster code
1:35 by leading to better understanding of the structure of the code.
1:39 I kind of touched on this little bit, but you'll have smaller files
1:44 which means fewer merge conflicts
1:48 it's easier to know like over here, the purpose of this file is
1:52 to do this one or two things, not jam it all together,
1:56 so I think the fact that we can navigate and understand
1:59 across these files really well is super important.
2:02 In PyCharm you have this concept of run configuration
2:05 so for example, on the project that runs the training website
2:09 it has, of course, a configuration that will run the Pyramid web application
2:14 that starts up, that is the website.
2:17 It also has unit tests, that it will run,
2:20 it can do code coverage and things like that,
2:22 that's another configuration that it knows about.
2:25 There's a bunch of little utility scripts and stuff
2:29 that do various things like back up data or transform data
2:31 or things like this in the web application,
2:35 and those have their own configurations,
2:38 maybe with builtin command line arguments already passed to them
2:41 so this ability to configure all of these different ways to run
2:43 and analyze your code are really powerful.
2:46 Because PyCharm understands the whole project,
2:49 it can re-factor across a whole bunch of files
2:53 and re-factor even things like docstrings and comments,
2:56 if I rename a function and there's a comment that talks about the function name,
2:59 I can have it rename that function name in the comment, that's really cool.
3:03 Similarly, because it understands everything
3:05 it gives you much more realistic and complete autocomplete or intellisense
3:10 that is try to go call a function, it goes boom,
3:13 here's what all the functions that are available say on this class,
3:16 or for this given function, here's what the arguments are,
3:20 this one takes a thing called URL and that's a string,
3:24 it takes a date and that's a datetime, something like this.
3:27 It has good understanding of virtual environments,
3:30 so we can create a number of different virtual environments
3:33 tie these to our run configurations
3:36 and have clean, reproducible isolated applications
3:40 every time we open up our project to make it go.
3:44 There is a really nice package management UI
3:47 so this is like pip, but there's also a UI version
3:50 it shows you all the various versions of what you have,
3:52 it will show you whether they're up to date or if there is an update for it,
3:56 it'll let you search for things that are related to what you're doing.
3:59 I find I don't use that that much these days,
4:03 because I am pretty comfortable with pip and just finding things,
4:06 but when I was new I found that really helpful
4:09 still every now and then it's kind of nice to just go pull it up
4:11 and search through what's available.
4:13 One of the really great things with the PyCharm is
4:15 that it has, there is probably an official term for it
4:17 but I call these "helper fixes," it's a little light bulb that'll come up saying
4:19 "You know, you called random.choice, but you didn't import random at the top,
4:24 so your code is going to fail, but don't worry,
4:27 I know that if I put import random at the top, then your code is going to run,
4:32 so just hit a key stroke and I'll fix it for you."
4:35 There is all these little fixes like this,
4:37 like, "You're trying to call this function on a module, it doesn't exist,
4:40 would you like me to write the function for you,
4:42 and then you go fill out the details?"
4:45 Or, "I see that you are using some external library in a file
4:49 but it's not in your requirements.txt, shall I add it?"
4:52 All these cool little "helper fixes" are super awesome
4:55 even if you know what you're doing,
4:57 the fact that you don't have to spend time thinking about it
4:59 it's just a single keystroke as you type
5:02 means you can stay in flow and keep on writing.
5:04 All right, great, source code integration, right,
5:07 get github and various other source control systems
5:11 as we'll see when we get into that,
5:13 this is really great if you don't want to leave your environment
5:15 to just do source control you have a visual source control as we'll see,
5:19 in the editor, in the project space all sorts of stuff.
5:22 The database tooling is super cool in PyCharm,
5:26 so it's really easy to understand various relational databases
5:30 and if you're even working with something like SQLAlchemy
5:33 that generates the database, there is still really great tools
5:36 to help you understand and explore
5:39 and even change the database once the table is being created.
5:42 We talked about package support, this is the ability to create new packages
5:48 to create the setup infrastructure or scaffolding
5:51 so that you can install and register your package and things like that.
5:55 And finally, the unit testing component is really great
5:58 if you're doing unit tests or even integration tests
6:01 you can write either pytest or a regular unit test tests for those
6:06 and then run them in PyCharm and get things
6:09 like code coverage and all sorts of stuff.
6:12 There is tons and tons more, and that's what we are going to cover in this course
6:15 it's all the things that I haven't even talked about yet, including these, of course.
6:19 So, why wouldn't you want all of this stuff at your fingertips?
6:22 I honestly don't know, I think you probably do,
6:25 that's why you're in this PyCharm class
6:27 and we're going to talk about how you make all of these things sing,
6:31 and do exactly what you want and way more.