Declare supported types in the `use` type
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- python
調査の方向性
Start by reading the accessor types and the array_support table in docs/conf.py (lines 171–213), then compare them with the type hints, runtime checks, and tests for functions such as tl.rank_genes_groups and umap. Define how supported array types should be represented in accessor annotations and how the docs should consume those declarations. Done means support declarations live with function types and the documentation reflects them consistently.
索引モデルが issue の本文から書いたものです。
説明
What kind of feature would you like to request?
Improved documentation or error message?
Please describe your wishes
Currently, which array types a function accepts is written down by hand in four places: the type hints, the array_support table in docs/conf.py, the array types each test picks, and a runtime check per function.
Apart from repeating code, these sometimes disagree. E.g., tl.rank_genes_groups runs on dask arrays and its test includes dask, but the conf.py table does not mention dask.
This gets more complicated with the recent accessoring, since use is typed as RepAcc which in turn translates to LayerAcc | MultiAcc. Thus, it is currently impossible to declare something like "this function only accepts accessors pointing to numpy or dask arrays" when following the established documentation patterns.
Instead of this, a few variants of RepAcc could provide the necessary documentation both in the code as well as for the docs directly. Example:
type RepInMemory = Annotated[LayerAcc | MultiAcc, ArraySupport("np", "sp")]
type RepLazy = Annotated[LayerAcc | MultiAcc, ArraySupport("np", "sp", "da", "xp")]
type RepGraphInMemory = Annotated[GraphAcc, ArraySupport("np", "sp")]
def umap(adata, *, use: RepGraphInMemory | str | None = None, rep: RepInMemory | str | None = None): ...
This would at least move the support declarations into the types of the functions and out of conf.py, which should make it easier for both humans and agents to see what is supported.
Nonetheless, this would not be enforcable on its own and would thus only be a first step. The next step might be to base runtime checks and test cases on this.
Ideally, it would be possible to declare the type an accessor would need to point to and have that be type-checked, but with the current accessor design in AnnData, I do not know how full typing could be implemented. So, the above would be my suggestion for now until full type checking becomes possible.
Please let me know if this is of interest and I can PR it.
- 主要言語
- Python
- スター
- 2.6k
- フォーク
- 809
- 平均マージ
- 1日 1時間
- マージ済み PR(30日)
- 79
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
scverse/scanpy のほかの issue
-
Area - Plotting 🌺
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
scverse/scanpy#3576 · コメント 1 件 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
scverse/scanpy#4564 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 18/100
scverse/scanpy#4563 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Meta
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
scverse/scanpy#4552 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
fossasia/eventyay-exhibition#465 · コメント 3 件 · リアクション 1 件 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
area/webapp comp/desktop P2 type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NousResearch/hermes-agent#163341 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
cpp-best-practices/project_validator#609 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
smart-village-solutions/smart-speech-flow#765 ·
メンテナーはふだん 1 日以内に返信