A collection of Python typing koans that teach type hints through hands-on exercises using Mypy.
Python Typing Koans is a hands-on educational project that helps developers learn Python's type hinting system through practical exercises. It provides a series of code files with intentional type errors that users must fix using Mypy, covering topics from basic annotations to advanced features like generics and protocols. The project offers a structured, interactive way to build proficiency in optional static typing.
Python developers who want to learn or improve their skills with type hints, especially those transitioning to Python 3's typing system or working on codebases that use Mypy for static analysis.
Unlike traditional tutorials, it emphasizes active learning by having users correct real type errors, which reinforces understanding through practice. It also includes specialized koans for popular frameworks like Django and Django REST Framework, making it immediately applicable for web developers.
Python typing koans to learn type-hints in Python3 using Mypy
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Koans are organized by difficulty from easy to medium, incrementally covering topics from variable annotation to advanced concepts like generics and protocols, as shown in the file listing.
Each koan file contains intentional type errors; users run Mypy to identify and fix them, reinforcing learning through active problem-solving, as demonstrated in the CLI output examples.
Includes specific koans for Django and Django REST Framework in dedicated directories, making it directly applicable for web developers learning to type-annotate real-world projects.
The project comes with a command-line interface to list koans, run checks on individual files, and track progress with a summary view, enhancing usability and learner engagement.
The README explicitly lists async example koans as a to-do item, meaning learners interested in asynchronous typing must seek additional resources to fill this gap.
Installation requires Poetry or managing dependencies with pip, which adds setup overhead compared to simpler, single-file learning tools, potentially deterring quick starters.
Exercises are tied to Mypy for type checking; users wanting to learn with other popular type checkers like Pyright or Pytype need to adapt the setup or find alternatives.