Declare supported types in the `use` type
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- machine-learning
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 2.6k
- Fork
- 809
- Merge trung bình
- 1 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 79
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của scverse/scanpy
-
Area - Plotting 🌺
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
scverse/scanpy#3576 · 1 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
scverse/scanpy#4564 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 18/100
scverse/scanpy#4563 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Document and classify `n_jobs` related things to be done to be robust against oversubscriptionĐang mởMeta
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
scverse/scanpy#4552 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của scverse/scanpy
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
fossasia/eventyay-exhibition#465 · 3 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area/webapp comp/desktop P2 type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NousResearch/hermes-agent#163341 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
cpp-best-practices/project_validator#609 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
smart-village-solutions/smart-speech-flow#765 ·
Maintainer thường phản hồi trong vòng 1 ngày