Note: The version of PyPI you see in this video has been superseded by the “Warehouse” version of pypi.org that I’ll introduce in the next lesson. If you already know the basics of how the PyPI package repository works, feel free to skip ahead to the next lesson to see the new layout and website design for PyPI.
Python Package Repositories
00:14 Python packages are collected in so called software repositories. The biggest, or official software repository in Python is called PyPI. It’s also sometimes called The Cheese Shop, because Python developers just love their Monty Python references.
00:32 Developers can register for a free PyPI account and then submit new packages to the repository. And once a package appears in PyPI, everyone else can install it through pip, 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, that you could just install through pip.
00:55 And by the way, there is no review or QA process for packages submitted to PyPI. So whenever you install a package from PyPI, it makes sense to invest some time into due diligence work and reviewing what’s available, so that you get a quality piece of software.
01:10 Let’s search for some packages on PyPI. We’re going to take a look at the PyPI website now, and you can find it at pypi.python.org. Lets fire up a browser and then take a look at the PyPI website.
01:26 Alright, this is PyPI, you can see some stats here so right now, 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 of recently updated packages as people pushed them to the package repository you can see here what was updated.
01:47 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 and basically do a full tech search on the descriptions and the metadata for the packages available on PyPI, so you’ve probably heard of the really popular Requests package, which is a HTTP download library, so I am going to go ahead and search for Requests here.
02:12 Okay, so these are the search results for Requests, and what is interesting here is that the actual Requests library 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 and the metadata in all of the available packages.
02:38 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, so it has its own page on PyPI where the developers can host the README and give some links to the documentation or release history, and stuff like that.
03:00 So what you can see here is that right now I am looking at the specific version of Requests, and you can also see that reflected here in the URL, so this will be at PyPI (slash) name of the library (slash) the version.
03:13 So this is handy if you ever want to link to a specific library or a specific version of library, because you can just use that link. This is the README file or the description that the creators of the Requests library have put together.
03:27 So the contents of this description here largely depend on the information that the library creators put in. Sometimes the formatting as it’s displayed on the PyPI website isn’t perfect, so you are going to get these super blown up images here, just ignore that for now.
03:43 Actually, what I wanted to show you is when you scroll all the way down here, there will always be the summary with metadata about the package that you are looking at, and this is often very useful if you want to find the homepage 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.
04:21 To me, the most useful information is usually these top three items here, I want to know about the library author, I usually take a look at the library home page and then I also want to know what license the software is under.
And of course, you could also click through these categories here and maybe find some interesting packages that way. Okay, that’s it for PyPI. You can also search for packages from the command line, using the
pip search command.
04:49 Usually I would recommend that you stick with the PyPI website though. The pip command doesn’t really give you very much information about those search results so it’s just the package name and then a very brief description, which can be useful but as you’ve seen in the PyPI demo, oftentimes, a single keyword can lead to many search results so it’s a little bit hard to untangle that from the command line if you only have limited information available.
Become a Member to join the conversation.