python / python/typing

Upgrade `typing.type_check_only` to be applicable to variables(and maybe import statements)

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

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

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

説明

from typing import _KT, _promote

Success: no issues found in 1 source file

Sure it has an underscore, but seems super sus that there is no mechanism to specify that a variable in a stub is just a type time helper and has no bearing on reality whatsoever.

You can specify explicitly that an import is accessible by importing it with an alias, although this in itself looks extremely hacky/workaroundy.

Also if it were possible to mark something in a stub as 'type time' only, then you could remove all the underscores and make a bunch of types look a lot nicer.

Very much related to https://github.com/python/mypy/issues/11503, where a module import in a stub can be completely fictitious, and there is currently no way to specify it one way or the other.

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

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

はじめの一歩

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

調査の方向性

まず、変数と import 文に対して要求されている typing.type_check_only の動作を確認し、次にスタブ内の架空のモジュールインポートに関する関連 issue #11503 を読んでください。型チェック時のみ有効な望ましいセマンティクスとインポート動作が明確に仕様化され、合意されていれば完了です。

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

評価

技術スタック
python
領域
tooling
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
30/100

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

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