Managing Python Dependencies Transcripts
Chapter: Managing Third-Party Dependencies With pip
Lecture: Identifying & Updating Outdated Packages

Login or purchase this course to watch this video and the rest of the course contents.
0:01 Another benefit of using a package manager is that you can keep your packages and dependencies up to date.
0:08 Pip can identify outdated packages that have new versions available and then also upgrade them to the latest version.
0:14 Let me show you how that works now. I am going to set up some kind of demo scenario we can work with here.
0:20 So what I am going to do is I am going to install an older version of the Requests library so that we can then go ahead and upgrade it.
0:33 So I just installed Requests 2.0 which is an older version of Requests at this moment.
0:39 What I am going to do next is I am going to ask pip to identify outdated packages; you can do that with the familiar pip list command,
0:51 and by adding a --outdated switch to it, so when I run this, it tells me exactly which packages
0:59 that I have currently installed are outdated and what the latest version is.
1:03 So in this case, I can tell that there is a newer version of Requests available. Now, let's upgrade Requests to the latest version.
1:11 Again, I am using the pip install command, but this time I am passing it a --upgrade switch. And then I need to tell it which library to upgrade,
1:24 so in this case, it will be Requests. this will first uninstall the outdated version of Requests, and then install the latest version.
1:39 By the way, you could get the same results with the -u switch, so that is just a shortcut for a --upgrade if you want to save some typing.
1:53 Let's make sure we actually upgraded to the latest version of Requests. I am going to run this pip list command with the --outdated switch again.
2:03 Alright, this time, there are no more outdated dependencies, and I just successfully upgraded Requests to the latest version.


Talk Python's Mastodon Michael Kennedy's Mastodon