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. The first is, Where are they?
0:09 The second is How do we get them installed? So PyPi, pypi.org, or the Python Package index, is where these packages live; these extra libraries live.
0:19 And at the time of recording, there's 267,000 projects. That's 267,000 other libraries that you could choose to install into
0:29 your program and start working with them. Whether you've got to create a little GUI app,
0:33 gotta build a web application based on some web framework like Django, all of those things live here,
0:39 and the one that we want is we want to be able to go and make a web request to an API. So the other side of the coin is how do we access PyPi and get
0:49 the stuff installed and manage them for our application? Well, that's what this command line tool called "pip".
0:55 So we're gonna work with a library called "requests" that lets us do the, well,
0:59 HTTP request over to the server to get that JSON document then convert it to a dictionary to give the weather report, and in order to use it,
1:07 it doesn't exist in Python. It's a separate thing. It works with Python, but it's not part of Python. So in order to work with it,
1:13 we have to install it into our current environment, alright? And the way we do that, we would just say "pip install requests",
1:20 sometimes you might want to throw in a "--upgrade" in case it's already there, go ahead and give me the latest version.
1:25 But you'll see it when it downloads it. Actually it already downloaded that version, so it didn't need to get it,
1:30 but you would see a progress bar go across as it downloads if it needs to
1:33 then it installs that package and all of its dependencies that it needs, maybe the dependencies
1:39 of the dependencies. So everything is ready to run for you,
1:41 and it gives you a message like "whatever package you asked for, the current version is installed".


Talk Python's Mastodon Michael Kennedy's Mastodon