5.2 A second group, for the checks

Build it yourself. Read the tutorial is the other way to read this part.

This walk goes through rahuldave/cheesecracker on GitHub. This part starts from the code at f77650600c11, partway through step-05. The code before this part

This part does not start where the part before it ends, because the walk skips some changes. This command puts the files that this part starts from in place of yours. Run it, and then go on:

git restore --source 54de20e8055e --staged -- :/ && git restore --source f77650600c11 --staged --worktree -- :/

If you start at this part, make your clone as Get the project says, and then run this command. It puts in your clone the files that this part starts from. A file that the project deleted before this part stays, so delete it if git check lists it:

git rm -rq --cached --ignore-unmatch -- :/ && git restore --source f77650600c11 --staged --worktree -- :/
just setup

The whole tutorial then adds the recipe just cov, and a change made in a hurry. ruff checks the code, and the server does not need it. So ruff starts a second group, lint.

5.2 ruff, the formatter and the linter, in the group lint

ruff is a formatter and a linter in one tool, written in Rust by Astral, the makers of uv. ruff format writes the code in the layout of black, the formatter of most Python projects. ruff check checks the rules of flake8 and of many other linters, and can fix some of them. It takes the place of both black and flake8, and runs much faster.

ruff checks the code, and the server does not need it to run. So ruff goes into a group of its own, lint.

uv add --group lint ruff
uv run ruff --version

uv prints the version of ruff, ruff 0.17.1 on the day of the class.

Check your files against this move. The command prints nothing when they match, and otherwise shows what differs:

git check 9662828462ba

If you are stuck, this command puts the files of this move in place of yours. A file that you made yourself stays:

git restore --source f77650600c11 --staged -- :/ && git restore --source 9662828462ba --staged --worktree -- :/

What changed

  • pyproject.toml: ruff, in the group lint. 3 lines added. It comes from uv add --group lint ruff. The file
    • look at "ruff>=0.17.1",
  • uv.lock: the exact version of ruff. 29 lines added. It comes from uv add --group lint ruff. The file

The diff that uv add --group lint ruff makes in pyproject.toml
@@ -16,6 +16,9 @@ package = false
 default-groups = "all"
 
 [dependency-groups]
+lint = [
+    "ruff>=0.17.1",
+]
 test = [
     "httpx2>=2.13.1",
     "pytest>=9.1.1",

This change on GitHub

This part ends at the code at 9662828462ba, partway through step-05. The code after this part