[docutils] Allow directive subclasses to type their options
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 5.1k
- フォーク
- 2.1k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 82
説明
Directive.options is annotated as dict[str, Incomplete]. Although each
directive subclass knows the keys and converted value types defined by its
option_spec, it cannot express that shape, forcing downstream code to
propagate Any or add casts and suppressions. One example is
https://github.com/adamtheturtle/sphinx-literalizer/pull/516.
Could Directive accept an option-mapping type parameter, defaulting to the
current incomplete mapping for compatibility? This would let subclasses use a
TypedDict for their converted options. Other designs that allow subclasses to
specialize options would also solve the problem.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
docutils の Directive エントリポイントから始め、options アノテーションと option_spec の関係に焦点を当てます。汎用的なオプションマッピングパラメーターによって、現在の不完全なマッピングをデフォルトで維持しつつ、サブクラスが TypedDict を使用できるようにする方法を調査します。完了の条件は、下流のコードが Any、casts、または suppressions なしで、特殊化された変換済みオプション型を取得できることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- tooling
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 68/100