Python Jumpstart by Building 10 Apps Transcripts
Chapter: App 5: Real-time weather client
Lecture: Concept: PyPI and PIP

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's talk about the two group together paired concepts of accessing these external libraries.
0:06 The first is, Where are they?
0:08 The second is How do we get them installed?
0:10 So PyPi,, or the Python Package index, is where these
0:15 packages live; these extra libraries live.
0:18 And at the time of recording,
0:19 there's 267,000 projects. That's 267,000 other libraries that you could choose to install into
0:28 your program and start working with them.
0:30 Whether you've got to create a little GUI app,
0:32 gotta build a web application based on some web framework like Django,
0:36 all of those things live here,
0:38 and the one that we want is we want to be able to go and make
0:41 a web request to an API.
0:44 So the other side of the coin is how do we access PyPi and get
0:48 the stuff installed and manage them for our application?
0:50 Well, that's what this command line tool called "pip".
0:54 So we're gonna work with a library called "requests" that lets us do the, well,
0:58 HTTP request over to the server to get that JSON document then convert it to
1:02 a dictionary to give the weather report, and in order to use it,
1:06 it doesn't exist in Python. It's a separate thing.
1:08 It works with python, but it's not part of python.
1:11 So in order to work with it,
1:12 we have to install it into our current environment,
1:15 alright? And the way we do that, we would just say "pip install requests",
1:19 sometimes you might want to throw in a "--upgrade" in case it's already there,
1:23 go ahead and give me the latest version.
1:24 But you'll see it when it downloads
1:26 it. Actually it already downloaded that version,
1:28 so it didn't need to get it,
1:29 but you would see a progress bar go across as it downloads if it needs to
1:32 then it installs that package and all of its dependencies that it needs, maybe the dependencies
1:38 of the dependencies. So everything is ready to run for you,
1:40 and it gives you a message like "whatever package you asked for, the current version is installed".