python / python/typing

Tutorial document

オープン
#891 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

topic: documentation
主要言語
Python
スター
1.8k
フォーク
302
平均マージ
23時間
マージ済み PR(30日)
8

説明

Thoughts on the tutorial document.

Basic Topics

  • Set up a basic venv with a pinned mypy version. (For compatibility reasons.) Should add a note about using a current version in production.
  • Annotating variables.
  • Annotating functions and methods.
  • Unions, using | None
  • Any
  • cast() and # type: ignore
  • Using generics, variance
  • Built-in collections
  • Type aliases
  • int/float
  • NoReturn (not strictly necessary, but a fairly easy topic)
  • Installing third-party stubs

Advanced Topics

The are fairly complicated topics, but basically required when typing a non-trivial code base:

  • Callable
  • Writing generics
  • Protocols
  • type[...]
  • typing.TYPE_CHECKING and circular imports
  • TypeVar and AnyStr
  • overloads
  • Literal

What not to include

  • # type annotations (except # type: ignore)

The following topics could arguably be included, but for simplicity's sake, I'd suggest to skip them in this basic tutorial:

  • NewType
  • ClassVar
  • Final
  • Annotated
  • NamedTuple
  • TypedDict

Other Thoughts

  • We can use a newer version of Python (e.g. 3.8+) for simplicity and add a note that not all features are available in older Python versions.
  • We should probably just use from __future__ import annotations and skip the whole forward references/quoting types problem.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

issue では、チュートリアルのファイル、エントリーポイント、テストのいずれも指定されていません。まず既存のチュートリアルドキュメントを見つけ、提案されている基本トピックと高度なトピックのリストと比較してください。チュートリアルの範囲、Python バージョンに関するガイダンス、含める typing トピック、除外事項について合意し、その決定を文書化できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
documentation
issue の種類
ドキュメント
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。