python / python/cpython

`Protocol` should be documented as using `ABCMeta` as metaclass

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

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

docs topic-typing
主要言語
Python
スター
77.2k
フォーク
36k
PR マージ指標
PR 指標を取得中

説明

Documentation

Came up in #127648.

Currently the documentation for typing.Protocol doesn't mention that Protocol has ABCMeta in its metaclasses (indirectly via _ProtocolMeta) and that its methods can (should?) be marked with @abstractmethod. In fact, neither the string "ABCMeta" nor "abstractmethod" appear in the documentation for the typing module.

I also suggest to add @abstractmethod to the examples using a Protocol as that is probably a best practice.

Finally, the documentation for Protocol suggests to see PEP 544 for more details. I don't think this is particularly helpful. All information relevant for users should be in the main documentation. PEP 544 should only be suggested as a historical document. (And I don't suggest to directly link to the typing spec, either, although a general link at the top of the page would be useful.)

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

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

はじめの一歩

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

調査の方向性

Issue にリンクされている typing.Protocol のドキュメントから始め、その指針を PEP 544 と比較します。Protocol の例と説明を確認し、要求されている ABCMeta、abstractmethod、および参照の網羅性を確認します。関連するユーザー向けの詳細が文書化され、PEP の参照が歴史的な文脈として位置付けられていれば完了です。

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

評価

技術スタック
python
領域
documentation
issue の種類
ドキュメント
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

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

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