Installing Ruff
00:00 If you want to learn how to use Ruff to lint and format your code, obviously you need to start by installing Ruff, but I just wanted to make a small disclaimer because Ruff is under active development.
00:13 So improvements and updates to the tool are fairly frequent, which means that when you install Ruff, you are very likely to get a version that’s more recent than the one I have when recording this for you.
00:26 But that’s perfectly fine because this course focuses on fundamental and core parts of the Ruff interface, which are unlikely to change significantly. But just a heads-up.
00:40
So to install Ruff, there’s a couple of ways to do it. Astral recommends that you install with uv
, but there are many different ways of installing Ruff.
00:49 Some depend on your operating system, so your best bet is to go to the official documentation guides, the Ruff installation guide, and follow the instructions there that you find the most suitable.
01:02
And once you do, once you have Ruff installed, you can check that the installation is successful by running the subcommand ruff --version
. I’ll show you right now what this looks like.
01:14 So you go to the docs, you install Ruff, and then you open your terminal.
01:21
And in your terminal, you just run ruff version
.
01:25
And if you get output that looks similar to the one you can see on the screen where it says ruff
and then a version number, in this case, it’s 0.12.9, and then some information about the checks and the dates, then everything is fine, and you are ready to go.
01:43 And if something is not working, then double-check the official documentation guide to make sure you’re installing Ruff properly.
01:51
As a small note, I just want to make sure that there’s no confusion. You just saw the command ruff version
in the terminal, but the command was run from inside the directory called ruff
, which is why if you look closely, the terminal will spell out ruff ruff
, which might even sound like a dog barking.
02:11
But just bear in mind that the first word, ruff
, which is in a different color and in bold, is the name of the directory you are in. And the ruff version
, which is not in bold and in white, is the command you are running.
02:27 So keep that in mind throughout the remaining lessons.
02:32 As soon as Ruff is installed, you’re ready to go and you’re ready to start linting your code, which is what you’ll do in the next lesson.
Become a Member to join the conversation.