Loading topic
str and int, which the previous chapter covered. It also assumes you work in a virtual environment on Python 3.10 or newer. Here you will install both checkers, run them, read their output, and handle the setup problems th5 min readint | str works at runtime.5 min readint | str, and can run mypy or Pyright on a file. Examples use Python 3.10 or newer. assert_never needs Python 3.11, or typing_extensions on older versions.4 min readreveal_type (earlier chapters cover these). Examples use str | None syntax, so they need Python 3.10 or newer.5 min readProtocol lets you describe an interface by its shape, where that differs from inheritance, and where it can mislead you.5 min readstr | None unions and narrowing. You need Python 3.11 or newer for the NotRequired example. On 3.10, import NotRequired from typing_extensions instead.5 min readmypy and pyright from the command line (covered earlier) and that your project already has a pyproject.toml. It also assumes Python 3.10 or newer. By the end you will have one file that configures both tools, with per-module exceptions and without surprises fro5 min readAny means in gradual typing. Here you will see what strict mode turns on in each tool, which errors it adds, and how to apply it to part of a codeb4 min readAny is and how narrowing works. Sometimes a checker reports an error you cannot or should not fix right now. Python gives you two tools for that: ignore comments, which hide a5 min readpyproject.toml. Earlier chapters covered those skills. Your own code is now annotated, but it imports libraries you did not write. The checker needs type information for those libraries too, and where it finds that info5 min readNone, and generics. It covers where the two tools give different answers on the same code and how to decide what to do about that.5 min readpyproject.toml. It also assumes you know what Any, # type: ignore and strict mode do. The goal is to add checking to a project with thousands of unannotated lines without a freeze on feature work, and without 5 min read