Skip to content

Sync python-type-checking with the updated tutorial - #982

Open
realpython-bot wants to merge 1 commit into
masterfrom
maintenance/python-type-checking-20261202
Open

realpython-bot wants to merge 1 commit into
masterfrom
maintenance/python-type-checking-20261202

Conversation

@realpython-bot

Copy link
Copy Markdown
Collaborator

Syncs python-type-checking/ with the full update of Python Type Checking (Guide). The update draft is Post 2425 (admin). Card: https://trello.com/c/FNGVkZQ7

Changes

  • game_00*.py, dogs_00*.py, hearts.py: copied from the draft's code blocks. They now use built-in generics, X | None, collections.abc, and typing.Self (in dogs_002.py) instead of a bound TypeVar.
  • Removed parse_name.py and parse.pyi: parse ships its own types now, so the article teaches stubs with pyjokes instead.
  • Added jokes.py, pyjokes.pyi, and table.py (the Typeshed / types-tabulate example).
  • Added requirements.txt, pinned to match the article's dependencies field, and rewrote the README with setup and usage.

Verification (Python 3.15.2, fresh venv from requirements.txt)

  • Ran every script. Hearts played to completion with scripted input.
  • mypy 2.4.1 passes on every file except dogs_001.py, whose two attr-defined errors are the ones the article teaches.
  • ruff format --check, ruff check (ruff 0.14.1), and dircheck.py pass.

🤖 Generated with Claude Code

Built-in generics, X | None, collections.abc, typing.Self; replace the
parse example with the pyjokes stubs and tabulate Typeshed examples;
add pinned requirements.txt and a README with setup and usage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant