Managing Python Dependencies Transcripts
Chapter: Managing Third-Party Dependencies With pip
Lecture: Python Package Repositories

Login or purchase this course to watch this video and the rest of the course contents.
0:01 An important part of dependency management is of course the ability to store packages somewhere so that you or other people can install them.
0:11 Now, let's talk about Python package repositories. Python packages are collected in so called software repositories.
0:19 The biggest, or official software repository in Python is called PyPi. It's also sometimes called the "Cheese Shop",
0:28 because Python developers just love their Monty Python references. Developers can register for a free PyPi account
0:36 and then submit new packages to the repository. And once a package appears in PyPi, everyone else can install it through pip,
0:44 so this is a really popular method to distribute open source Python packages, and there are literally tens of thousands of packages available for free,
0:52 that you could just install through pip. And by the way, there is no review or QA process for packages submitted to PyPi.
1:01 So whenever you install a package from PyPi, it makes sense to invest some time into do diligence work
1:07 and reviewing what's available, so that you get a quality piece of software. Let's search for some packages on PyPi.
1:15 We're going to take a look at the PyPi website now, and you can find it at pypi.Python.org.
1:22 Lets fire up a browser and then take a look at the PyPi website. Alright, this is PyPi, you can see some stats here so right now,
1:32 they are close to a 100 thousand packages available here, on PyPi, and when you scroll down, you can see sort of a update log
1:40 of recently updated packages as people pushed them to the package repository you can see here what was updated.
1:48 And of course, one of the most important parts of the site here is the search box. So into the search box, you can enter keywords
1:55 and basically do a full text search on the descriptions and the metadata for the packages available on PyPi,
2:02 so you've probably heard of the really popular Requests package, which is a HTTP download library, so I am going to go ahead
2:10 and search for Requests here. Okay, so these are the search results for Requests, and what is interesting here is that the actual Requests library
2:19 that I was looking for, is not the number one search result, right, because this is just doing a search across all of the descriptions
2:26 and the metadata in all of the available packages. So I get some very exhaustive results here, and you can see here
2:33 as I scroll down this is a really long list, because, obviously the keyword Requests seems to be quite popular.
2:39 Alright, so I am going to go ahead and click on the Requests library here, because, every package in PyPi actually has its own landing page,
2:49 so it has its own page on PyPi where the developers can host the readme
2:54 and give some links to the documentation or release history, and stuff like that. So what you can see here is that right now
3:05 I am looking at the specific version of Requests, and you can also see that reflected here in the url,
3:10 so this will be a pypi-name of the library-the version. So this is handy if you ever want to link to a specific library
3:18 or a specific version of library, because you can just use that link. This is the readme file or the description
3:25 that the creators of the Requests library have put together. So the contents of this description here largely depend
3:32 on the information that the library creators put in. Sometimes the formatting as it's displayed on the PyPi website isn't perfect,
3:40 so you are going to get these super blown up images here, just ignore that for now.
3:44 Actually, what I wanted to show you is when you scroll all the way down here, there will always be the summary with metadata
3:56 about the package that you are looking at, and this is often very useful if you want to find the homepage
4:02 for a specific project or if you want to identify its author or if you are interested in the license that the code is under.
4:11 Then, also, you can see the categories the code is filed under, or the library it was filed under, and then also what other dependencies
4:18 or secondary dependencies that library requires. To me, the most useful information is usually these top 3 items here,
4:25 I want to know about the library author, I usually take a look at the library home page
4:32 and then I also want to know what license the software is under. And of course, you could also click through these categories here
4:38 and maybe find some interesting packages that way. Okay, that's it for PyPi. You can also search for packages from the command line,
4:48 using the pip search command. Usually I would recommend that you stick with the PyPi website though.
4:54 The pip command doesn't really give you very much information about those search results so it's just the package name
5:00 and then a very brief description, which can be useful but as you've seen in the PyPi demo, oftentimes,
5:06 a single keyword can lead to many search results so it's a little bit hard to untangle that from the command line
5:13 if you only have limited information available. Nevertheless, that feature exists and it can be useful in a pinch.


Talk Python's Mastodon Michael Kennedy's Mastodon