Rock Solid Python with Python Typing Transcripts
Chapter: Static vs. Dynamic Languages
Lecture: Running the Source Code

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Enough big ideas, let's start writing some code. Now I've already git cloned the repo that we're going to be working with.
0:09 But let's go ahead and talk through setting this up for the very first time. So here's the repo that we're working with.
0:16 Notice that there is no virtual environment, but we've got things like our code that we're going to write over here.
0:23 Now I'm going to open this up in PyCharm. But the same thing would apply in VS Code.
0:27 you're doing that as well, it's good practice to have a virtual environment. Now in the beginning, this is not going to really matter whether we have a
0:35 virtual environment, because the first few steps don't require external
0:40 dependencies. But as we get further on, as we get to runtime type verification, or
0:44 the different frameworks, then we're going to need to install them. We want to
0:48 do that in an isolated local way. So let's create a virtual environment to get us started. We'll open up a terminal.
0:57 If you're on Windows, make sure you're using the new Windows terminal, not because it's required but because it's better.
1:03 And let's create a virtual environment. Now I have a shortcut venv that I always use. So let me show you what that is.
1:10 So it's alias to several commands, we're going to run not just Python dash m venv, venv,
1:17 but we're going to do --prompt is dot and that will make the name of the virtual environment be type hence course.
1:24 And then we're going to activate it on macOS and Linux that's venv/bin/activate
1:30 with the dot to apply to the shell on Windows, drop the dot and it's VNV scripts activate dot bat.
1:37 And then finally, we're going to make sure that we don't have an outdated pip. All right, so we'll run that.
1:45 And you can see we now have this virtual environment here. We ask which Python three, and it's the one on my desktop here that we just created.
1:54 We want to open this now in PyCharm. Again, if you want to do this in VS Code, that's fine. I'm going to use PyCharm.
1:59 Now, PyCharm sometimes is awesome, finds that virtual environment. Other times, no, not at all. So notice down here it says 3.11.
2:10 That means the system one, not what we want. So we'll add a new interpreter. It tries to make a new one where we put it, but it says it's already,
2:18 I don't know what's going on here, PyCharm. But anyway, we'll switch it over to existing. if you can browse to it, if it doesn't auto detect it.
2:26 But here you can see we're now running the right Python. And we've got all of our code over here that we're going to be working with.
2:33 So there you have it. You can tell that it is already set up. You could try to run one of these files just to make sure.
2:39 Can't run the Swift, run one of the Python files. Just to make sure that it's running correctly. And also while we're here,
2:47 just to save us a little bit of trouble, you can see that this is golden, this virtual environment, but that means it's not committed into Git
2:54 and it's ignored explicitly in Git, but it's still possibly when we do autocomplete and things, PyCharm might think it's part of our project.
3:01 So we can right click, say mark directory as excluded. Now it's both golden and orange, reddish with a orangish golden background,
3:11 whatever color they call that. That means it's gonna be excluded, which is gonna be helpful for when we're doing all the stuff we're working with later
3:19 show how awesome our autocomplete becomes when type hints are enabled. There we have our Python all set up and ready to go.


Talk Python's Mastodon Michael Kennedy's Mastodon