 Hey, welcome to another Microsoft soundbites. I'm Gez. I'm Stratus. And today we're going to look at Microsoft PIP. PyPI is the Python packaging index. And PIP is the tool that we use to install and manage packages from generally from PyPI. Microsoft obviously is written primarily in Python and skills can make use of any package that comes from there, which is really useful. There's a truckload of stuff that you can do. What the microp-pip command does is make sure that these packages are installed in your Python virtual environment, which we covered last week. So if you missed that, click there and watch that video. You just want to install a Python package, right? So rather than where you would normally say PIP install package name, you just replace that with microp-pip install package name. Rather than installing into your system-wide Python path, it's going to install in the virtual environment and therefore be available for your skill, but also not clutter up the rest of your system. But maybe we'll just go through a few of our tips and tricks that we use when we're using PIP Stratus. I know you got burnt recently. What happened? So I maintain a series of, we'll call them scripts that ingest some data from an API and then dump them into an InflexDB database. And one of the things that I forget about from time to time is that while your package manager keeps everything up to date on your system, it doesn't include PIP. And so something had changed in the API and one of the libraries that I'm relying upon to do some of the lifting needed an update. So the API change was enough that I actually had my scripts break and had people start opening up issues and it took me 20 minutes to figure out that I needed to update the PIP library because it doesn't update automatically for you. And the versioning is a whole area that is worth exploring. So when you are installing a package, you can specify a very specific version with a package name double equals the version number. It can be useful to pin a package to a very specific version or it can also be useful to provide a range of packages that are going to work. There's no one hard and fast rule that works in every situation, unfortunately. It is pretty common to see when there's a requirements.txt. It is pretty common to see a version mentioned either the double equals to say exactly this version or greater than or less than this version. So you just mentioned requirements.txt. What is a requirements.txt? So really it's just a text file that has a list of the PIP packages that you want to install. So if you have a micro skill, for example, that has a requirements.txt in it and you just want to make sure that all of the dependencies for that skill are installed, you can do micro attach PIP install dash R and then the path to that text file and it will go through each line and install each of those. And the other really useful use of PIP is when we're testing say a feature branch of one of micro technology. So if you're working on a project like Lingua Franca, our multilingual passing and formatting library and you want to try out some new version of that we can actually install Python packages from GitHub or from any Git repository. And so for that you use the URL. So you'd say micro attach PIP install the URL but you need to modify that. We should just jump into the command line really quickly and have a quick look at that. Back at the command line now and what would you like me to do master of ceremonies? Just do a quick run through of some of the things that we just talked about. So, you know, if we wanted to install a package just any normal Python package we'd use micro attach PIP install and then let's try, yeah, requests, perfect. So it's probably going to be installed. You can see that it's already satisfied. It's got a version 2.20.0. So it doesn't really do anything. It just makes sure that it's already installed. Okay, imagine we found a problem in requests and we found that we really needed to update to a newer version of requests. So we might say micro attach PIP install request without a space after request. We'll do double equals and then let's say 2.21.0. This goes back to what we were talking about is that micro pins very specific versions of the libraries that it uses. Yeah, and so this can cause problems, you know, like this. So it hasn't prevented us from installing this new version of requests. It has told us that there might be an error because this other package believes that it needs some specific version of requests as well. Cool, and then finally, if we want to install something like a feature branch of Ling or Franca we can use micro attach PIP install. Here we're going to install something from the micro skills manager, a feature branch from the micro skills manager. And what we have in the URL is that when you get this URL from GitHub, where you can see tarball, so you've got github.com. That tarball is going to start out as tree, t-r-w-e, and so we just need to switch that, change that to tarball. And what that does is github will send you a tarball. So using this URL, we're going to get that tarball and then it will be able to install that. It's a nice easy way of testing features from some of our technologies. This wasn't a re-implementation of PIP. It's just kind of a wrapper to make sure that PIP puts stuff into your virtual omp in the appropriate places. So what that means is that you can rely on the micro-pip-h and actually take a look at all of the commands that are there. And you'll see if you're familiar with PIP, they should look very familiar. All right, so we covered a bit about PIP and how micro-pip is just an aid to help you put your PIP packages inside of your virtual environment. You saw that we touched on installing MSM from a specific URL, and in another video we'll probably take a look at MSM. But for this one, I think that's all that we really wanted to introduce you to the wrapper around PIP that comes with Mycroft and just the idea that Mycroft pins specific PIP package versions and that's just something to be aware of. Yeah, so this is going to be useful if you're developing skills or if you're doing any development work or doing any review work on other Mycroft technologies. So yeah, good one to have under the belt. Absolutely. But until next time. Until next time. Ciao. Ciao.