00:0.04 I spent some time telling you how cool pie charm is,
00:2.08 but I think it's time that we actually get down to business and write some code
00:5.56 and work with some python projects.
00:7.28 What do you think now before I start my charm?
00:9.89 I want to point out one thing really quickly here.
00:12.24 So remember I recommended that used the Jetbrains toolbox to install pie charm because it keeps
00:17.51 it up to date. For example,
00:18.52 if I want android studio, I just click that button,
00:20.83 I have it and it keeps itself up to date.
00:23.34 So you can actually see three versions of pie charm over here.
00:26.47 Even though we were told there were two there's a e a p early access program
00:31.37 that I'm going to be using because there are some cosmetic changes that are coming in
00:36.05 pie charm. I've been talking to the pie charm team that I got to be
00:39.16 aware that there's some changes coming.
00:40.89 I want to make sure that you incorporate that into the new course.
00:43.84 So I'm going to be using this e a p version but I recommend you just
00:47.83 use the main stable dev version unless you feel like living on the cutting edge with
00:52.65 that out of the way, let's get started.
00:54.84 So I could just go to pi charm right here.
00:57.87 You see, here's a couple of projects I've already had open and I could just
01:0.9 click new project or I could even say get from get version control but I want
01:7.55 to have something come from get and then work on different projects nested within their and
01:11.25 that's not gonna work perfectly. I'm going to have a little bit of structure from
01:14.54 the Git repository. So in general you might just start a new project or open
01:18.06 from get but we're gonna go to the ghetto repository up here and we're gonna clone
01:22.64 this onto the desktop. No over the desktop.
01:27.84 Give it some clone instead of calling it this whole long name,
01:31.51 I'm just going to call it course.
01:34.84 Perfect, perfect. And then here you can see we have our Get master.
01:39.39 I'm gonna actually use a different branch in just a moment.
01:42.64 Every now and then people ask me,
01:43.7 how do you get this prompt?
01:44.75 This is oh my Seashell, absolutely not required.
01:47.66 But it is kind of handy now,
01:49.14 I don't want to work in this branch here.
01:50.71 So I'm gonna say get check out now.
01:52.85 Normally would do this in pie chart but I want to give you the fresh experience
01:55.44 So I got to get things set up to be this fresh experience.
01:58.99 Now with oh my G shell you can actually hit tab and it will give you
02:2.74 all of the branches which is awesome.
02:4.72 You're gonna just be working with the default branch.
02:6.74 But as I'm updating this course from the previous version,
02:9.71 I don't want to break it while it's in flight and being created.
02:12.99 So here we go. Now we can go over to our project folder here and
02:18.22 notice we've got our demos, we've got projects and there's a bunch of cool stuff
02:21.82 we're gonna be working on but we're at our first project and in here you can
02:25.82 see it's effectively empty. So what we're gonna do is we're going to create a
02:29.82 new project and pie charm over there.
02:32.14 We have new project and notice right away we got a bunch of options.
02:36.03 It suggests maybe it should go here.
02:37.79 I'm going to propose that maybe somewhere else would be better.
02:41.34 So I'm gonna drag this folder over here so Mac os can find it in this
02:48.25 project here. I'd like to create the project.
02:51.07 That's great. And it's going to create what's called a virtual environment.
02:54.56 You may be familiar with these if you're not.
02:56.24 These are really important building blocks to keep our projects separated and clean the ideas instead
03:2.57 of using the system python with all the libraries that might be installed.
03:5.67 We're going to create basically a copy an isolated empty fresh version of python using a
03:11.35 virtual environment that then when we install libraries to it's just dedicated to that project.
03:16.42 Soap. I charm is proposing to automatically do that for us and I'll say,
03:20.31 great, you can do that if we actually had other interpreters,
03:23.8 maybe we've already created one on the command line or something like that.
03:26.74 We could browse to it and pie chart would detect it if it were there following
03:30.39 certain conventions like dot e n V or v e n V for the name.
03:34.34 It would suggest that as well as an option,
03:36.64 it's also proposing to create a main welcome script,
03:38.96 which kind of says, here's how you run pie charm.
03:42.25 We're not going to do that.
03:43.0 We're going to start fresh. But you could leave that check if you wish.
03:47.04 Your python is not the only option.
03:48.35 We have jingo, we have flask pyramid,
03:52.25 we have scientific stuff, we even have some front and things like react and angular
03:55.8 but we're going to stick with our pure python.
03:58.87 You all right? That should be it.
04:0.13 We should be able to get going.
04:2.54 I was saying there's this placeholder file in there,
04:4.65 which I needed to make get create that structure.
04:7.46 Uh so I'll just say create from this,
04:9.34 but it doesn't really matter which we choose.
04:12.54 You notice right away a couple of things.
04:14.01 It's looking through all the installed libraries and python to figure out the auto complete and
04:19.05 code corrections and things like that.
04:20.89 So that takes a moment. But just the first time you open it down here
04:24.28 you can see which virtual environment is running this is the interpreter and you also
04:29.71 see the ghetto branch that we checked out right there.
04:32.69 That's all cool. And here's our virtual environment that got created and we're not gonna
04:37.92 need our placeholder. So we can go ahead and delete that.
04:40.74 So here we have our empty project.
04:42.37 We might as well start by creating a file if we go over to the project
04:46.73 here, let's say new. There's all kinds of new files we can get,
04:49.39 it's not just python, we could create jupiter notebooks,
04:52.24 we could create style sheets, we could create javascript files,
04:55.97 all sorts of things. Even the funny Gherkin feature file if you wish,
05:0.14 we're going to start by creating a python file and I'll just call this Hello because
05:5.76 we're working in a directory that has a Git repository somewhere above it.
05:10.53 Is itself a Git repository. Hi tom says,
05:13.9 hey, we can automatically add that to get up for you notice it's red over
05:17.26 here, we're going to dive into the source control features.
05:19.16 But I'll just so it doesn't bother us.
05:20.83 I'll say sure you can go ahead and add those files.
05:22.82 It turned green because now it's staged and get but not yet committed.
05:28.04 Okay, so in our Hello World file,
05:30.33 you know the drill, we're going to do something like print.
05:32.81 Hello World as we type it,
05:36.75 all sorts of help. Very nice.
05:40.44 Often the Hello World people perceive this as how do I create the most minimalistic type
05:45.67 of application that I can, but that's not really the purpose of Hello World.
05:50.06 The purpose of Hello World is to prove that the system is set up to run
05:53.93 some kind of application in this case,
05:55.67 the python app. So it'll prove that our virtual environment set up and that we
05:59.21 can, you know, click this button up here maybe somehow and make it run
06:3.38 So how are we going to do that?
06:5.24 We'd like to click this looks like a run thing you hover over.
06:7.76 It says run but obviously it's great out.
06:10.16 It's not going to do anything because we could have many python files.
06:13.1 Open empire charm doesn't know what to do with them.
06:15.74 What we can do is we can right click over here and we can pick any
06:19.35 of these options. Run debug or even we could run with code coverage.
06:23.06 We could profile it, we could do concurrency analysis.
06:26.97 All that seems way overkill for Hello world.
06:29.51 So we're just going to run it like this.
06:32.54 The world. Perfect there. You have it,
06:34.42 you can see that it ran our file here way out at the end and it
06:39.72 ran it using the python, out of our virtual environment.
06:42.81 That pie charm created not the system one.
06:45.84 And by the way, if you need to run outside of price I'm just copy
06:48.33 that path, that whole thing there and drop into a command prompt or terminal and
06:52.52 boom off you go. So now that we've run it,
06:56.64 we right clicked and said run this is generated what's called a run configuration up here
07:0.65 now it says hello, we can change the name but we can just click this
07:4.07 button over and over and over to run it now I have a presentation assistant installed
07:8.09 which I mentioned before in the previous chapter but if I click this it's going
07:12.86 to actually pop up this green box that says run Hello via control are on your
07:17.41 current key map or if you're on windows relating.
07:20.11 So you can press shift F 10 depending on the key map you pick.
07:23.68 Sometimes that's F five. So if I hit that hot key again you can see
07:27.0 right here. It just keeps running it.
07:28.74 But this is something you really want to pay attention to as we work with different
07:32.35 parts of pie charm, it will help you learn what the various commands are being
07:37.31 called. And sometimes like if I say wanted to reformat this code here,
07:41.74 I could come over to code and I could click reformat or I could just hit
07:45.69 command lt L. So sometimes I'll do something like this.
07:48.82 You know what happened? Just look at the green box,
07:51.47 that's what's going on there. One other thing to look at here is we don't
07:57.7 need just the one file. Right.
07:59.39 One of the beauties of pipe charm is it understands many many files.
08:2.19 We could have another file and here we could have something like an other method.
08:7.94 It takes some text and I'll print print out whatever the other text is.
08:17.89 Now there's a little squiggly here meaning that the formatting is a little bit off so
08:21.66 we'll just let pie charm fix it.
08:23.46 So it doesn't look like there's some kind of air.
08:25.74 Right. But of course what we're running is our Hello World app over there.
08:29.94 All right, well, that's the quick introduction to getting started.
08:33.34 Main takeaways. Virtual environment. Very important if you're in a GIT hub repository or
08:39.48 some other kind of source control,
08:41.47 it likely will discover that and automatically integrate that.
08:44.57 Like we didn't do anything. This just happened automatically.
08:48.14 When we want to run a file,
08:50.24 we have to go over here and say first create some kind of run configuration so
08:55.93 that we can then click here.
08:57.13 Hit control are to run it.
09:0.44 That's it. We've written a program with Pie charm.
09:3.64 Well, I would be too proud of this thing,
