Effective PyCharm Transcripts
Chapter: Tool windows
Lecture: A better Python REPL

Login or purchase this course to watch this video and the rest of the course contents.
0:01 The next one that we're going to talk about is the Python repl. So that's what happens when you go over here and you type Python,
0:07 hopefully Python 3, this thing over here, this read print evaluate, print loop over here that we can run
0:15 and it's great that we can go to the shell and run this, but it'd be nice if we had a way to work with the Python repl
0:23 that knew about our project, that knew about our settings, our virtual environment, all that kind of stuff.
0:28 Well, that's what's called the Python console and it's pretty sweet and this is like a brand new thing over here on the right actually
0:34 so there's a couple of things to notice, first, it's explicitly calling out that we're working in our sort of root folder up here,
0:43 so that's been added, that's great and it's also running our virtual environment, this is the one that we put in the beginning.
0:52 So this is really great, and look at this, it even remembers what I was doing before, so let's play around a little bit,
0:57 if I say var = some value, notice over on the right we have var = some value, and we could even change it
1:06 this is basically the debugger, this could be some other value and then now here we say var, and you can bet it's this.
1:14 So that's pretty cool, we have this kind of like live debugger view into the Python repl,
1:19 in my opinion that's massively, massively better than just typing Python in the shell, so the other thing that we can do, because of this really
1:29 is we can work with our project, it's also awesome that we have our virtual environment so we can come over here and say import and notice
1:38 we can import course. oh actually I don't think we got that far we say demos.projects. and look here's our entire project
1:48 what do you want to work with, let's work with the podcast one, down here, what do we have, we have the program and we have the service
1:57 and we could say as svc, we can say svc. and look at that, this is all of the stuff that we get there so let's say download this, right,
2:08 it's going out to Talk Python and downloading that, I could say get episode like this and let's put 122, I'm sure that will be around,
2:16 bam, look at that, so we can jump right in and you get auto complete you get all of your project set up,
2:25 you get it the same as you're running, the same virtual environments, all these things, and on top of that, we get this great debugger over here,
2:33 if we open this, this is like the things that it finds, so here's the little service thing that we've created
2:39 you can get things like the name and so on, so we come over here and look at our episode data,
2:44 and look, there's all the upsides, pretty sweet way to explore the shell here. I really like this, I find that I use it some of the time
2:54 when I kind of want to test something out and I know I need my database connection and my models and I just need my environment but also want the repl.
3:02 Here you go, this is how you do it.


Talk Python's Mastodon Michael Kennedy's Mastodon