Overview & Use Cases - PyCharm
Learn more about PyCharm in our dedicated tutorial: PyCharm for Productive Python Development (Guide)
00:00 Hello everyone to this section about PyCharm. We’ve talked about a couple of text editors, and in this section, I want to talk about a full blown IDE—so, an integrated development environment—and PyCharm is a great example for that.
00:15 We’ll start off with the overview and I’ll talk about a couple of use cases, when it’s actually very helpful to have a full-blown IDE at your fingertips.
00:24 When you open up PyCharm first—here I’m doing this with a Django project—it’s going to look something like this. It’s fully customizable and it’s actually very easy.
00:33 There’s this one shortcut that I’ll talk to you about right away, which is this Search Everywhere, Shift + Shift. When I press Shift + Shift, it opens up this search box that allows me to search through the whole project structure. PyCharm thinks of your project as a project, which means it can contain a lot, a lot of different files and folders, and it just has an understanding of this whole level of everything that’s going on in there. That’s what makes it so powerful. So when I go for a search here, I’m going to start off, for example, if I search for “theme”
01:07 on here, you can see it gives me a couple of options and among others, there’s this Preferences > Appearance, so I can go in here. And you see, PyCharm already highlights for me what did I search for. I searched for “theme” here, so I get these highlights, and here I can change it to something else.
01:22 I like to work with this High contrast one, so I’ll do that instead. Press Apply and my editor looks different.
01:29
But that’s just an example of how you can use this Search Everywhere to access preferences, but you can also access files. So I can say, “Okay, I’m going to search for urls.py
” and it offers me there’s two files called urls.py
—one in projects
folder, one in portfolio
folder. Okay, so I choose which one do I want, press Enter, and right away I’m in that file.
01:51
So navigation becomes very quick and easy. I can even navigate to a certain variable, so if I say “DATABASE”, for example, I get the option to jump right to that declaration of DATABASES
in settings.py
. It takes me directly there, you see?
02:09 So this Search Everywhere feature, it’s very, very powerful. So that’s something if you get started with PyCharm, just remember Shift + Shift and then you can get to a lot of places and learn more about it. Okay, what else makes it a useful development environment?
02:24 So as the name IDE says—integrated development environment—we have a couple of things here that come with the editor already, that are not part of others. So we have, for example, a terminal included that I can open up by just pressing here.
02:38
And one thing you can notice on this side is that I have a virtual environment already activated. When you create a new PyCharm project, by default it also makes a virtual environment for you, so you don’t have to deal with that, which is a great thing, actually. So here, pip freeze
, I can see I already have Django
installed because it’s a project I worked on before.
03:00 But I did not manually activate the virtual environment—I didn’t even have to manually create it. This is just something that PyCharm does for you. So it helps to keep your development environment clean and your computer settings separate from other projects. Another place where I can look for that—Shift + Shift again—I can go in there and I can say “Look at the project settings,” so I just the type the name.
03:24
There’s portfolio-done
, for example.
03:28 And I can go to the Preferences and here in the Project Interpreter I can also quickly see all the packages that I have installed. I can see the versions.
03:38
I can add a package directly without even using pip
on the command line. I’m still using it. Or you can remove a package, update them, et cetera.
03:48 So, it gives you this user interface that makes it maybe a bit easier to interact with it when you’re getting started. Great, so we have the terminal right in here.
03:58
I can say python manage.py runserver
…
04:05 and inside of PyCharm it starts off my Django server right away. You can do anything you can do with a terminal right in here. And it’s just one piece, so it makes it very easy.
04:19 All right. Another thing, we have a Python Console included, so if I click on this, it opens up a Python console—in this case, even a Django console, that’s just because it’s a Django project.
04:30
But in here, you can do anything that you could do in a console. I’m going to just show you quickly, I can import random
and then I say dot (.
) and it gives me autocompletion, right? So .randint()
.
04:43 And if you forget about what it can do, you can press Command + P and it shows you stuff. What can you put in there? Don’t worry if you’re not remembering all this stuff that I’m saying here. I just want to give you a quick overview that there’s lots and lots of powerful features in PyCharm, and we’ll talk about some important ones in just a bit. All right. So here’s the console. Yeah, run whatever you want to run in a console.
05:06 We have very powerful debugging features. And yeah, I’ll just mention that very shortly, because we’ll go into it a bit more in a separate video. But if you want to go in here, you can just simply create a breakpoint—
05:21 there it is. You can quickly create a breakpoint by just clicking here into the edge next to the numbers. And yeah, this creates a breakpoint. You can run the debugger by pressing this bug symbol up here.
05:32 There’s also a shortcut: Command + D, we enter the debugger. But we’ll look at that in a bit in more detail. I know this is a lot. Just two more things I want to show you.
05:44 So, what also makes PyCharm integrated and very useful compared to other editors is that it understands a lot of different languages—for example, HTML—and it has this project-level understanding.
05:57 So here, I’m referencing a template file, and PyCharm gives me this option to simply by a click access that template file. So I can just hop over there, and here I’m inside of some Django templating language.
06:10
It understands HTML, so the HTML is properly formatted. The Django templating language is properly formatted. There’s shortcuts. I can just say for
and press Tab and it autocompletes for me a very common structure.
06:27 You can also create those yourself in the Preferences.
06:31 So, it just can make development very quick. And the good thing is that it doesn’t only understand Python, but without needing to do anything, it already understands a lot of other languages as well. That goes as far as that—in the professional version—you have the database explorer.
06:49 So, you can go double-click on your database file here. And here, for example, you can see the schema, you can see what are the different tables in there.
06:58
You can do crazy stuff, like let’s say for projects_project
let’s make a diagram. Show Visualization… and this is maybe a boring one, but if you have a bigger database, you can see all the connections and you can see it in a very easily-digestible format. So that’s a bunch of cool stuff that you can do with PyCharm and that gives you the powers when you’re actually using such a big program as this one is. It does take a lot more of your memory space, so you’re going to need a bit more RAM if you want to actually work with something like that as compared to VIM or VS Code.
07:37 But if you’re working on a big project that includes a lot of files, such as web development often does—if you’re working on a web app that has a database, that has tons of different files, a templating language, a backend language, front end language, and all these different parts—then having a powerful tool such as PyCharm that has this project-level understanding and understanding of all the different languages and lots of useful shortcuts and features can be very, very helpful.
08:02 Now, there’s a lot to learn and you’re not going to understand everything right away—I don’t by now—but it’s just a step-by-step process and I promise you, you can become very, very effective working with a good tool such as PyCharm. Okay.
08:16 So that’s the quick, pretty long overview. I just wanted to show you a couple of the things that are possible, and now let’s dive in and build out our code snippet in the next section.
Martin Breuss RP Team on March 29, 2020
Hi @Charlie, in this course I’m working with the Professional (=paid) version of PyCharm.
A lot of the useful features are included in the free Community version as well, however things such as the Web and Web Framework support (e.g. for Django syntax etc.) as well as the support for the Database features are not part of the free edition.
PyCharm Community is still a great IDE with tons of features. You can compare the paid and free versions and what they each include on PyCharms comparison site.
Charlie Clemmer on March 29, 2020
Excellent. Thanks for the clarification and further explanation, Martin!
Become a Member to join the conversation.
Charlie Clemmer on March 29, 2020
Is this version of PyCharm the community version, or the paid version?
I’ve heard about PyCharm as I started getting into Python, but was only aware of the paid version. Curious on the differences between the two versions.