Explainer on what is supported
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- ドキュメント
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
調査の方向性
issue にはファイルやテストの指定がありません。まず既存の NumPy typing ドキュメントと 2 つの mypy の例を確認し、その後、どのような動作と制限をドキュメント化すべきかを判断してください。サポートされている typing の動作と rank-reduction のケースを網羅する、明確な説明または機能一覧があれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Issue with current documentation:
Not necessarily related to numtype but NumPy typing in general. I'm a bit confused as to what is expected to work in user code and what isn't. Is there some documentation which explains this? Perhaps a page or simple list of features would help elucidate this for users.
As a concrete example - I'd like a type checker to be able to pick up this example related to reducing rank of the array. This should fail, but currently passes with mypy v1.19.1 NumPy v2.4.0 Python 3.14. Is this sort of thing even possible without language changes or runtime typing? Is support for this on the horizon?
from typing import NewType
from numpy import ndarray
import numpy as np
A = NewType("A", int)
B = NewType("B", int)
C = NewType("C", int)
type U8 = np.dtype[np.uint8]
# Should fail - currently pass. Actual returned type is `ndarray[tuple[B], U8]`
def f1(a: ndarray[tuple[A, B, C], U8]) -> ndarray[tuple[A, B], U8]:
return a[:, 2, :]
rng = np.random.default_rng(0)
a: ndarray[tuple[A, B, C], U8] = rng.integers(0, 100, size=(10, 20, 30), dtype=np.uint8)
print(f1(a).shape)
By contrast this correctly fails with mypy
# Should fail - correctly fails
# error: Incompatible return value type (got "ndarray[tuple[A, B, C], dtype[unsignedinteger[_8Bit]]]", expected "ndarray[tuple[A, C, B], dtype[unsignedinteger[_8Bit]]]") [return-value]
def f2(a: ndarray[tuple[A, B, C], U8]) -> ndarray[tuple[A, C, B], U8]:
return a + 2
a: ndarray[tuple[A, B, C], U8] = rng.integers(0, 100, size=(10, 20, 30), dtype=np.uint8)
print(f2(a).shape)
Idea or request for content:
No response
- 主要言語
- Python
- スター
- 79
- フォーク
- 8
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
numpy/numtype のほかの issue
-
topic: documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
long pyright analysis times再び着手できるかも @jorenham が 421 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンblame: Pyright tool: basedpyright
-
numpy.generic stubs: Incomplete
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
-
_numtype stubs: Refactor
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
-
_numtype stubs: Refactor
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
似ている issue
-
good first issue hacktoberfest
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
RogueAlg0/taken#387 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
tool-calling
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
vllm-project/vllm#59838 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
raullenchai/Rapid-MLX#4042 ·
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
transitmatters/mbta-slow-zone-bot#70 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
open-webui/open-webui#31871 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信